(function (three,dat,Stats) {
  'use strict';

  dat = dat && dat.hasOwnProperty('default') ? dat['default'] : dat;
  Stats = Stats && Stats.hasOwnProperty('default') ? Stats['default'] : Stats;

  var fragment = "uniform sampler2D tPreviousLum;\r\nuniform sampler2D tCurrentLum;\r\nuniform float minLuminance;\r\nuniform float delta;\r\nuniform float tau;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tfloat previousLum = texture2D(tPreviousLum, vUv, MIP_LEVEL_1X1).r;\r\n\tfloat currentLum = texture2D(tCurrentLum, vUv, MIP_LEVEL_1X1).r;\r\n\r\n\tpreviousLum = max(minLuminance, previousLum);\r\n\tcurrentLum = max(minLuminance, currentLum);\r\n\r\n\t// Adapt the luminance using Pattanaik's technique.\r\n\tfloat adaptedLum = previousLum + (currentLum - previousLum) * (1.0 - exp(-delta * tau));\r\n\r\n\tgl_FragColor.r = adaptedLum;\r\n\r\n}\r\n";

  var vertex = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var asyncGenerator = function () {
    function AwaitValue(value) {
      this.value = value;
    }

    function AsyncGenerator(gen) {
      var front, back;

      function send(key, arg) {
        return new Promise(function (resolve, reject) {
          var request = {
            key: key,
            arg: arg,
            resolve: resolve,
            reject: reject,
            next: null
          };

          if (back) {
            back = back.next = request;
          } else {
            front = back = request;
            resume(key, arg);
          }
        });
      }

      function resume(key, arg) {
        try {
          var result = gen[key](arg);
          var value = result.value;

          if (value instanceof AwaitValue) {
            Promise.resolve(value.value).then(function (arg) {
              resume("next", arg);
            }, function (arg) {
              resume("throw", arg);
            });
          } else {
            settle(result.done ? "return" : "normal", result.value);
          }
        } catch (err) {
          settle("throw", err);
        }
      }

      function settle(type, value) {
        switch (type) {
          case "return":
            front.resolve({
              value: value,
              done: true
            });
            break;

          case "throw":
            front.reject(value);
            break;

          default:
            front.resolve({
              value: value,
              done: false
            });
            break;
        }

        front = front.next;

        if (front) {
          resume(front.key, front.arg);
        } else {
          back = null;
        }
      }

      this._invoke = send;

      if (typeof gen.return !== "function") {
        this.return = undefined;
      }
    }

    if (typeof Symbol === "function" && Symbol.asyncIterator) {
      AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
        return this;
      };
    }

    AsyncGenerator.prototype.next = function (arg) {
      return this._invoke("next", arg);
    };

    AsyncGenerator.prototype.throw = function (arg) {
      return this._invoke("throw", arg);
    };

    AsyncGenerator.prototype.return = function (arg) {
      return this._invoke("return", arg);
    };

    return {
      wrap: function (fn) {
        return function () {
          return new AsyncGenerator(fn.apply(this, arguments));
        };
      },
      await: function (value) {
        return new AwaitValue(value);
      }
    };
  }();





  var classCallCheck = function (instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
  };

  var createClass = function () {
    function defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }

    return function (Constructor, protoProps, staticProps) {
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
      if (staticProps) defineProperties(Constructor, staticProps);
      return Constructor;
    };
  }();







  var get = function get(object, property, receiver) {
    if (object === null) object = Function.prototype;
    var desc = Object.getOwnPropertyDescriptor(object, property);

    if (desc === undefined) {
      var parent = Object.getPrototypeOf(object);

      if (parent === null) {
        return undefined;
      } else {
        return get(parent, property, receiver);
      }
    } else if ("value" in desc) {
      return desc.value;
    } else {
      var getter = desc.get;

      if (getter === undefined) {
        return undefined;
      }

      return getter.call(receiver);
    }
  };

  var inherits = function (subClass, superClass) {
    if (typeof superClass !== "function" && superClass !== null) {
      throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
    }

    subClass.prototype = Object.create(superClass && superClass.prototype, {
      constructor: {
        value: subClass,
        enumerable: false,
        writable: true,
        configurable: true
      }
    });
    if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  };











  var possibleConstructorReturn = function (self, call) {
    if (!self) {
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    }

    return call && (typeof call === "object" || typeof call === "function") ? call : self;
  };

  var AdaptiveLuminosityMaterial = function (_ShaderMaterial) {
  			inherits(AdaptiveLuminosityMaterial, _ShaderMaterial);

  			function AdaptiveLuminosityMaterial() {
  						classCallCheck(this, AdaptiveLuminosityMaterial);
  						return possibleConstructorReturn(this, (AdaptiveLuminosityMaterial.__proto__ || Object.getPrototypeOf(AdaptiveLuminosityMaterial)).call(this, {

  									type: "AdaptiveLuminosityMaterial",

  									defines: {

  												MIP_LEVEL_1X1: "0.0"

  									},

  									uniforms: {

  												tPreviousLum: new three.Uniform(null),
  												tCurrentLum: new three.Uniform(null),
  												minLuminance: new three.Uniform(0.01),
  												delta: new three.Uniform(0.0),
  												tau: new three.Uniform(1.0)

  									},

  									fragmentShader: fragment,
  									vertexShader: vertex,

  									depthWrite: false,
  									depthTest: false

  						}));
  			}

  			return AdaptiveLuminosityMaterial;
  }(three.ShaderMaterial);

  var fragment$1 = "uniform sampler2D tDiffuse;\r\nuniform sampler2D tDepth;\r\n\r\nuniform float focus;\r\nuniform float dof;\r\nuniform float aspect;\r\nuniform float aperture;\r\nuniform float maxBlur;\r\n\r\nvarying vec2 vUv;\r\n\r\n#ifndef USE_LOGDEPTHBUF\r\n\r\n\t#include <packing>\r\n\r\n\tuniform float cameraNear;\r\n\tuniform float cameraFar;\r\n\r\n\tfloat readDepth(sampler2D depthSampler, vec2 coord) {\r\n\r\n\t\tfloat fragCoordZ = texture2D(depthSampler, coord).x;\r\n\t\tfloat viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\r\n\r\n\t\treturn viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\r\n\r\n\t}\r\n\r\n#endif\r\n\r\nvoid main() {\r\n\r\n\tvec2 aspectCorrection = vec2(1.0, aspect);\r\n\r\n\t#ifdef USE_LOGDEPTHBUF\r\n\r\n\t\tfloat depth = texture2D(tDepth, vUv).x;\r\n\r\n\t#else\r\n\r\n\t\tfloat depth = readDepth(tDepth, vUv);\r\n\r\n\t#endif\r\n\r\n\tfloat focusNear = clamp(focus - dof, 0.0, 1.0);\r\n\tfloat focusFar = clamp(focus + dof, 0.0, 1.0);\r\n\r\n\t// Calculate a DoF mask.\r\n\tfloat low = step(depth, focusNear);\r\n\tfloat high = step(focusFar, depth);\r\n\r\n\tfloat factor = (depth - focusNear) * low + (depth - focusFar) * high;\r\n\r\n\tvec2 dofBlur = vec2(clamp(factor * aperture, -maxBlur, maxBlur));\r\n\r\n\tvec2 dofblur9 = dofBlur * 0.9;\r\n\tvec2 dofblur7 = dofBlur * 0.7;\r\n\tvec2 dofblur4 = dofBlur * 0.4;\r\n\r\n\tvec4 color = vec4(0.0);\r\n\r\n\tcolor += texture2D(tDiffuse, vUv);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.0,   0.4 ) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.15,  0.37) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.29,  0.29) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.37,  0.15) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.40,  0.0 ) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.37, -0.15) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.29, -0.29) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.15, -0.37) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.0,  -0.4 ) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.15,  0.37) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.29,  0.29) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.37,  0.15) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.4,   0.0 ) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.37, -0.15) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.29, -0.29) * aspectCorrection) * dofBlur);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.15, -0.37) * aspectCorrection) * dofBlur);\r\n\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.15,  0.37) * aspectCorrection) * dofblur9);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.37,  0.15) * aspectCorrection) * dofblur9);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.37, -0.15) * aspectCorrection) * dofblur9);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.15, -0.37) * aspectCorrection) * dofblur9);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.15,  0.37) * aspectCorrection) * dofblur9);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.37,  0.15) * aspectCorrection) * dofblur9);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.37, -0.15) * aspectCorrection) * dofblur9);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.15, -0.37) * aspectCorrection) * dofblur9);\r\n\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.29,  0.29) * aspectCorrection) * dofblur7);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.40,  0.0 ) * aspectCorrection) * dofblur7);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.29, -0.29) * aspectCorrection) * dofblur7);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.0,  -0.4 ) * aspectCorrection) * dofblur7);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.29,  0.29) * aspectCorrection) * dofblur7);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.4,   0.0 ) * aspectCorrection) * dofblur7);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.29, -0.29) * aspectCorrection) * dofblur7);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.0,   0.4 ) * aspectCorrection) * dofblur7);\r\n\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.29,  0.29) * aspectCorrection) * dofblur4);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.4,   0.0 ) * aspectCorrection) * dofblur4);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.29, -0.29) * aspectCorrection) * dofblur4);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.0,  -0.4 ) * aspectCorrection) * dofblur4);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.29,  0.29) * aspectCorrection) * dofblur4);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.4,   0.0 ) * aspectCorrection) * dofblur4);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2(-0.29, -0.29) * aspectCorrection) * dofblur4);\r\n\tcolor += texture2D(tDiffuse, vUv + (vec2( 0.0,   0.4 ) * aspectCorrection) * dofblur4);\r\n\r\n\tgl_FragColor = color / 41.0;\r\n\r\n}\r\n";

  var vertex$1 = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var BokehMaterial = function (_ShaderMaterial) {
  	inherits(BokehMaterial, _ShaderMaterial);

  	function BokehMaterial() {
  		var camera = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  		var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  		classCallCheck(this, BokehMaterial);


  		var settings = Object.assign({
  			focus: 1.0,
  			dof: 0.02,
  			aperture: 0.025,
  			maxBlur: 1.0
  		}, options);

  		var _this = possibleConstructorReturn(this, (BokehMaterial.__proto__ || Object.getPrototypeOf(BokehMaterial)).call(this, {

  			type: "BokehMaterial",

  			uniforms: {

  				cameraNear: new three.Uniform(0.1),
  				cameraFar: new three.Uniform(2000),
  				aspect: new three.Uniform(1.0),

  				tDiffuse: new three.Uniform(null),
  				tDepth: new three.Uniform(null),

  				focus: new three.Uniform(settings.focus),
  				dof: new three.Uniform(settings.dof),
  				aperture: new three.Uniform(settings.aperture),
  				maxBlur: new three.Uniform(settings.maxBlur)

  			},

  			fragmentShader: fragment$1,
  			vertexShader: vertex$1,

  			depthWrite: false,
  			depthTest: false

  		}));

  		_this.adoptCameraSettings(camera);

  		return _this;
  	}

  	createClass(BokehMaterial, [{
  		key: "adoptCameraSettings",
  		value: function adoptCameraSettings(camera) {

  			if (camera !== null) {

  				this.uniforms.cameraNear.value = camera.near;
  				this.uniforms.cameraFar.value = camera.far;
  				this.uniforms.aspect.value = camera.aspect;
  			}
  		}
  	}]);
  	return BokehMaterial;
  }(three.ShaderMaterial);

  var fragment$2 = "#include <common>\r\n\r\nuniform sampler2D tDiffuse;\r\nuniform sampler2D tDepth;\r\n\r\nuniform vec2 texelSize;\r\nuniform vec2 halfTexelSize;\r\n\r\nuniform float cameraNear;\r\nuniform float cameraFar;\r\n\r\nuniform float focalLength;\r\nuniform float focalStop;\r\n\r\nuniform float maxBlur;\r\nuniform float luminanceThreshold;\r\nuniform float luminanceGain;\r\nuniform float bias;\r\nuniform float fringe;\r\nuniform float ditherStrength;\r\n\r\n#ifdef SHADER_FOCUS\r\n\r\n\tuniform vec2 focusCoords;\r\n\r\n#else\r\n\r\n\tuniform float focalDepth;\r\n\r\n#endif\r\n\r\nvarying vec2 vUv;\r\n\r\n#ifndef USE_LOGDEPTHBUF\r\n\r\n\t#include <packing>\r\n\r\n\tfloat readDepth(sampler2D depthSampler, vec2 coord) {\r\n\r\n\t\tfloat fragCoordZ = texture2D(depthSampler, coord).x;\r\n\t\tfloat viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\r\n\r\n\t\treturn viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n#ifdef PENTAGON\r\n\r\n\tfloat penta(vec2 coords) {\r\n\r\n\t\tconst vec4 HS0 = vec4( 1.0,          0.0,         0.0, 1.0);\r\n\t\tconst vec4 HS1 = vec4( 0.309016994,  0.951056516, 0.0, 1.0);\r\n\t\tconst vec4 HS2 = vec4(-0.809016994,  0.587785252, 0.0, 1.0);\r\n\t\tconst vec4 HS3 = vec4(-0.809016994, -0.587785252, 0.0, 1.0);\r\n\t\tconst vec4 HS4 = vec4( 0.309016994, -0.951056516, 0.0, 1.0);\r\n\t\tconst vec4 HS5 = vec4( 0.0,          0.0,         1.0, 1.0);\r\n\r\n\t\tconst vec4 ONE = vec4(1.0);\r\n\r\n\t\tconst float P_FEATHER = 0.4;\r\n\t\tconst float N_FEATHER = -P_FEATHER;\r\n\r\n\t\tfloat inOrOut = -4.0;\r\n\r\n\t\tvec4 P = vec4(coords, vec2(RINGS_FLOAT - 1.3));\r\n\r\n\t\tvec4 dist = vec4(\r\n\t\t\tdot(P, HS0),\r\n\t\t\tdot(P, HS1),\r\n\t\t\tdot(P, HS2),\r\n\t\t\tdot(P, HS3)\r\n\t\t);\r\n\r\n\t\tdist = smoothstep(N_FEATHER, P_FEATHER, dist);\r\n\r\n\t\tinOrOut += dot(dist, ONE);\r\n\r\n\t\tdist.x = dot(P, HS4);\r\n\t\tdist.y = HS5.w - abs(P.z);\r\n\r\n\t\tdist = smoothstep(N_FEATHER, P_FEATHER, dist);\r\n\t\tinOrOut += dist.x;\r\n\r\n\t\treturn clamp(inOrOut, 0.0, 1.0);\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n#ifdef SHOW_FOCUS\r\n\r\n\tvec3 debugFocus(vec3 c, float blur, float depth) {\r\n\r\n\t\tfloat edge = 0.002 * depth;\r\n\t\tfloat m = clamp(smoothstep(0.0, edge, blur), 0.0, 1.0);\r\n\t\tfloat e = clamp(smoothstep(1.0 - edge, 1.0, blur), 0.0, 1.0);\r\n\r\n\t\tc = mix(c, vec3(1.0, 0.5, 0.0), (1.0 - m) * 0.6);\r\n\t\tc = mix(c, vec3(0.0, 0.5, 1.0), ((1.0 - e) - (1.0 - m)) * 0.2);\r\n\r\n\t\treturn c;\r\n\r\n\t}\r\n\r\n#endif\r\n\r\n#ifdef VIGNETTE\r\n\r\n\tfloat vignette() {\r\n\r\n\t\tconst vec2 CENTER = vec2(0.5);\r\n\r\n\t\tconst float VIGNETTE_OUT = 1.3;\r\n\t\tconst float VIGNETTE_IN = 0.0;\r\n\t\tconst float VIGNETTE_FADE = 22.0; \r\n\r\n\t\tfloat d = distance(vUv, CENTER);\r\n\t\td = smoothstep(VIGNETTE_OUT + (focalStop / VIGNETTE_FADE), VIGNETTE_IN + (focalStop / VIGNETTE_FADE), d);\r\n\r\n\t\treturn clamp(d, 0.0, 1.0);\r\n\r\n\t}\r\n\r\n#endif\r\n\r\nvec2 rand2(vec2 coord) {\r\n\r\n\tvec2 noise;\r\n\r\n\t#ifdef NOISE\r\n\r\n\t\tconst float a = 12.9898;\r\n\t\tconst float b = 78.233;\r\n\t\tconst float c = 43758.5453;\r\n\r\n\t\tnoise.x = clamp(fract(sin(mod(dot(coord, vec2(a, b)), 3.14)) * c), 0.0, 1.0) * 2.0 - 1.0;\r\n\t\tnoise.y = clamp(fract(sin(mod(dot(coord, vec2(a, b) * 2.0), 3.14)) * c), 0.0, 1.0) * 2.0 - 1.0;\r\n\r\n\t#else\r\n\r\n\t\tnoise.x = ((fract(1.0 - coord.s * halfTexelSize.x) * 0.25) + (fract(coord.t * halfTexelSize.y) * 0.75)) * 2.0 - 1.0;\r\n\t\tnoise.y = ((fract(1.0 - coord.s * halfTexelSize.x) * 0.75) + (fract(coord.t * halfTexelSize.y) * 0.25)) * 2.0 - 1.0;\r\n\r\n\t#endif\r\n\r\n\treturn noise;\r\n\r\n}\r\n\r\nvec3 processTexel(vec2 coords, float blur) {\r\n\r\n\tvec3 c;\r\n\tc.r = texture2D(tDiffuse, coords + vec2(0.0, 1.0) * texelSize * fringe * blur).r;\r\n\tc.g = texture2D(tDiffuse, coords + vec2(-0.866, -0.5) * texelSize * fringe * blur).g;\r\n\tc.b = texture2D(tDiffuse, coords + vec2(0.866, -0.5) * texelSize * fringe * blur).b;\r\n\r\n\t// Calculate the luminance of the constructed colour.\r\n\tfloat luminance = linearToRelativeLuminance(c);\r\n\tfloat threshold = max((luminance - luminanceThreshold) * luminanceGain, 0.0);\r\n\r\n\treturn c + mix(vec3(0.0), c, threshold * blur);\r\n\r\n}\r\n\r\nfloat linearize(float depth) {\r\n\r\n\treturn -cameraFar * cameraNear / (depth * (cameraFar - cameraNear) - cameraFar);\r\n\r\n}\r\n\r\nfloat gather(float i, float j, float ringSamples, inout vec3 color, float w, float h, float blur) {\r\n\r\n\tconst float TWO_PI = 6.28318531;\r\n\r\n\tfloat step = TWO_PI / ringSamples;\r\n\tfloat pw = cos(j * step) * i;\r\n\tfloat ph = sin(j * step) * i;\r\n\r\n\t#ifdef PENTAGON\r\n\r\n\t\tfloat p = penta(vec2(pw, ph));\r\n\r\n\t#else\r\n\r\n\t\tfloat p = 1.0;\r\n\r\n\t#endif\r\n\r\n\tcolor += processTexel(vUv + vec2(pw * w, ph * h), blur) * mix(1.0, i / RINGS_FLOAT, bias) * p;\r\n\r\n\treturn mix(1.0, i / RINGS_FLOAT, bias) * p;\r\n\r\n}\r\n\r\nvoid main() {\r\n\r\n\t#ifdef USE_LOGDEPTHBUF\r\n\r\n\t\tfloat depth = linearize(texture2D(tDepth, vUv).x);\r\n\r\n\t#else\r\n\r\n\t\tfloat depth = linearize(readDepth(tDepth, vUv));\r\n\r\n\t#endif\r\n\r\n\t#ifdef SHADER_FOCUS\r\n\r\n\t\t#ifdef USE_LOGDEPTHBUF\r\n\r\n\t\t\tfloat fDepth = linearize(texture2D(tDepth, focusCoords).x);\r\n\r\n\t\t#else\r\n\r\n\t\t\tfloat fDepth = linearize(readDepth(tDepth, focusCoords));\r\n\r\n\t\t#endif\r\n\r\n\t#else\r\n\r\n\t\tfloat fDepth = focalDepth;\r\n\r\n\t#endif\r\n\r\n\t#ifdef MANUAL_DOF\r\n\r\n\t\tconst float nDoFStart = 1.0; \r\n\t\tconst float nDoFDist = 2.0;\r\n\t\tconst float fDoFStart = 1.0;\r\n\t\tconst float fDoFDist = 3.0;\r\n\r\n\t\tfloat focalPlane = depth - fDepth;\r\n\t\tfloat farDoF = (focalPlane - fDoFStart) / fDoFDist;\r\n\t\tfloat nearDoF = (-focalPlane - nDoFStart) / nDoFDist;\r\n\r\n\t\tfloat blur = (focalPlane > 0.0) ? farDoF : nearDoF;\r\n\r\n\t#else\r\n\r\n\t\tconst float CIRCLE_OF_CONFUSION = 0.03; // 35mm film = 0.03mm CoC.\r\n\r\n\t\tfloat focalPlaneMM = fDepth * 1000.0;\r\n\t\tfloat depthMM = depth * 1000.0;\r\n\r\n\t\tfloat focalPlane = (depthMM * focalLength) / (depthMM - focalLength);\r\n\t\tfloat farDoF = (focalPlaneMM * focalLength) / (focalPlaneMM - focalLength);\r\n\t\tfloat nearDoF = (focalPlaneMM - focalLength) / (focalPlaneMM * focalStop * CIRCLE_OF_CONFUSION);\r\n\r\n\t\tfloat blur = abs(focalPlane - farDoF) * nearDoF;\r\n\r\n\t#endif\r\n\r\n\tblur = clamp(blur, 0.0, 1.0);\r\n\r\n\t// Dithering.\r\n\tvec2 noise = rand2(vUv) * ditherStrength * blur;\r\n\r\n\tfloat blurFactorX = texelSize.x * blur * maxBlur + noise.x;\r\n\tfloat blurFactorY = texelSize.y * blur * maxBlur + noise.y;\r\n\r\n\tconst int MAX_RING_SAMPLES = RINGS_INT * SAMPLES_INT;\r\n\r\n\t// Calculation of final color.\r\n\tvec4 color;\r\n\r\n\tif(blur < 0.05) {\r\n\r\n\t\tcolor = texture2D(tDiffuse, vUv);\r\n\r\n\t} else {\r\n\r\n\t\tcolor = texture2D(tDiffuse, vUv);\r\n\r\n\t\tfloat s = 1.0;\r\n\t\tint ringSamples;\r\n\r\n\t\tfor(int i = 1; i <= RINGS_INT; ++i) {\r\n\r\n\t\t\tringSamples = i * SAMPLES_INT;\r\n\r\n\t\t\t// Constant loop.\r\n\t\t\tfor(int j = 0; j < MAX_RING_SAMPLES; ++j) {\r\n\r\n\t\t\t\t// Break earlier.\r\n\t\t\t\tif(j >= ringSamples) { break; }\r\n\r\n\t\t\t\ts += gather(float(i), float(j), float(ringSamples), color.rgb, blurFactorX, blurFactorY, blur);\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tcolor.rgb /= s; // Divide by sample count.\r\n\r\n\t}\r\n\r\n\t#ifdef SHOW_FOCUS\r\n\r\n\t\tcolor.rgb = debugFocus(color.rgb, blur, depth);\r\n\r\n\t#endif\r\n\r\n\t#ifdef VIGNETTE\r\n\r\n\t\tcolor.rgb *= vignette();\r\n\r\n\t#endif\r\n\r\n\tgl_FragColor = color;\r\n\r\n}\r\n";

  var vertex$2 = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var Bokeh2Material = function (_ShaderMaterial) {
  		inherits(Bokeh2Material, _ShaderMaterial);

  		function Bokeh2Material() {
  				var camera = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  				var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  				classCallCheck(this, Bokeh2Material);


  				var settings = Object.assign({
  						texelSize: null,
  						rings: 3,
  						samples: 2,
  						showFocus: false,
  						manualDoF: false,
  						vignette: false,
  						pentagon: false,
  						shaderFocus: true,
  						noise: true
  				}, options);

  				var _this = possibleConstructorReturn(this, (Bokeh2Material.__proto__ || Object.getPrototypeOf(Bokeh2Material)).call(this, {

  						type: "Bokeh2Material",

  						defines: {

  								RINGS_INT: settings.rings.toFixed(0),
  								RINGS_FLOAT: settings.rings.toFixed(1),
  								SAMPLES_INT: settings.samples.toFixed(0),
  								SAMPLES_FLOAT: settings.samples.toFixed(1)

  						},

  						uniforms: {

  								tDiffuse: new three.Uniform(null),
  								tDepth: new three.Uniform(null),

  								texelSize: new three.Uniform(new three.Vector2()),
  								halfTexelSize: new three.Uniform(new three.Vector2()),

  								cameraNear: new three.Uniform(0.1),
  								cameraFar: new three.Uniform(2000),

  								focalLength: new three.Uniform(24.0),
  								focalStop: new three.Uniform(0.9),

  								maxBlur: new three.Uniform(1.0),
  								luminanceThreshold: new three.Uniform(0.5),
  								luminanceGain: new three.Uniform(2.0),
  								bias: new three.Uniform(0.5),
  								fringe: new three.Uniform(0.7),
  								ditherStrength: new three.Uniform(0.0001),

  								focusCoords: new three.Uniform(new three.Vector2(0.5, 0.5)),
  								focalDepth: new three.Uniform(1.0)

  						},

  						fragmentShader: fragment$2,
  						vertexShader: vertex$2,

  						depthWrite: false,
  						depthTest: false

  				}));

  				_this.setShowFocusEnabled(settings.showFocus);
  				_this.setManualDepthOfFieldEnabled(settings.manualDoF);
  				_this.setVignetteEnabled(settings.vignette);
  				_this.setPentagonEnabled(settings.pentagon);
  				_this.setShaderFocusEnabled(settings.shaderFocus);
  				_this.setNoiseEnabled(settings.noise);

  				if (settings.texelSize !== null) {

  						_this.setTexelSize(settings.texelSize.x, settings.texelSize.y);
  				}

  				_this.adoptCameraSettings(camera);

  				return _this;
  		}

  		createClass(Bokeh2Material, [{
  				key: "setShowFocusEnabled",
  				value: function setShowFocusEnabled(enabled) {

  						if (enabled) {

  								this.defines.SHOW_FOCUS = "1";
  						} else {

  								delete this.defines.SHOW_FOCUS;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setManualDepthOfFieldEnabled",
  				value: function setManualDepthOfFieldEnabled(enabled) {

  						if (enabled) {

  								this.defines.MANUAL_DOF = "1";
  						} else {

  								delete this.defines.MANUAL_DOF;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setVignetteEnabled",
  				value: function setVignetteEnabled(enabled) {

  						if (enabled) {

  								this.defines.VIGNETTE = "1";
  						} else {

  								delete this.defines.VIGNETTE;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setPentagonEnabled",
  				value: function setPentagonEnabled(enabled) {

  						if (enabled) {

  								this.defines.PENTAGON = "1";
  						} else {

  								delete this.defines.PENTAGON;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setShaderFocusEnabled",
  				value: function setShaderFocusEnabled(enabled) {

  						if (enabled) {

  								this.defines.SHADER_FOCUS = "1";
  						} else {

  								delete this.defines.SHADER_FOCUS;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setNoiseEnabled",
  				value: function setNoiseEnabled(enabled) {

  						if (enabled) {

  								this.defines.NOISE = "1";
  						} else {

  								delete this.defines.NOISE;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setTexelSize",
  				value: function setTexelSize(x, y) {

  						this.uniforms.texelSize.value.set(x, y);
  						this.uniforms.halfTexelSize.value.set(x, y).multiplyScalar(0.5);
  				}
  		}, {
  				key: "adoptCameraSettings",
  				value: function adoptCameraSettings(camera) {

  						if (camera !== null) {

  								this.uniforms.cameraNear.value = camera.near;
  								this.uniforms.cameraFar.value = camera.far;
  								this.uniforms.focalLength.value = camera.getFocalLength();
  						}
  				}
  		}]);
  		return Bokeh2Material;
  }(three.ShaderMaterial);

  var fragment$3 = "uniform sampler2D texture1;\r\nuniform sampler2D texture2;\r\n\r\nuniform float opacity1;\r\nuniform float opacity2;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvec4 texel1 = opacity1 * texture2D(texture1, vUv);\r\n\tvec4 texel2 = opacity2 * texture2D(texture2, vUv);\r\n\r\n\t#ifdef SCREEN_MODE\r\n\r\n\t\tvec3 invTexel1 = vec3(1.0) - texel1.rgb;\r\n\t\tvec3 invTexel2 = vec3(1.0) - texel2.rgb;\r\n\r\n\t\tvec4 color = vec4(\r\n\t\t\tvec3(1.0) - invTexel1 * invTexel2,\r\n\t\t\ttexel1.a + texel2.a\r\n\t\t);\r\n\r\n\t#else\r\n\r\n\t\tvec4 color = texel1 + texel2;\r\n\r\n\t#endif\r\n\r\n\tgl_FragColor = color;\r\n\r\n}\r\n";

  var vertex$3 = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var CombineMaterial = function (_ShaderMaterial) {
  	inherits(CombineMaterial, _ShaderMaterial);

  	function CombineMaterial() {
  		var screenMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  		classCallCheck(this, CombineMaterial);

  		var _this = possibleConstructorReturn(this, (CombineMaterial.__proto__ || Object.getPrototypeOf(CombineMaterial)).call(this, {

  			type: "CombineMaterial",

  			uniforms: {

  				texture1: new three.Uniform(null),
  				texture2: new three.Uniform(null),

  				opacity1: new three.Uniform(1.0),
  				opacity2: new three.Uniform(1.0)

  			},

  			fragmentShader: fragment$3,
  			vertexShader: vertex$3,

  			depthWrite: false,
  			depthTest: false

  		}));

  		_this.setScreenModeEnabled(screenMode);

  		return _this;
  	}

  	createClass(CombineMaterial, [{
  		key: "setScreenModeEnabled",
  		value: function setScreenModeEnabled(enabled) {

  			if (enabled) {

  				this.defines.SCREEN_MODE = "1";
  			} else {

  				delete this.defines.SCREEN_MODE;
  			}

  			this.needsUpdate = true;
  		}
  	}]);
  	return CombineMaterial;
  }(three.ShaderMaterial);

  var fragment$4 = "uniform sampler2D tDiffuse;\r\n\r\nvarying vec2 vUv0;\r\nvarying vec2 vUv1;\r\nvarying vec2 vUv2;\r\nvarying vec2 vUv3;\r\n\r\nvoid main() {\r\n\r\n\t// Sample top left texel.\r\n\tvec4 sum = texture2D(tDiffuse, vUv0);\r\n\r\n\t// Sample top right texel.\r\n\tsum += texture2D(tDiffuse, vUv1);\r\n\r\n\t// Sample bottom right texel.\r\n\tsum += texture2D(tDiffuse, vUv2);\r\n\r\n\t// Sample bottom left texel.\r\n\tsum += texture2D(tDiffuse, vUv3);\r\n\r\n\t// Compute the average.\r\n\tgl_FragColor = sum * 0.25;\r\n\r\n}\r\n";

  var vertex$4 = "uniform vec2 texelSize;\r\nuniform vec2 halfTexelSize;\r\nuniform float kernel;\r\n\r\nvarying vec2 vUv0;\r\nvarying vec2 vUv1;\r\nvarying vec2 vUv2;\r\nvarying vec2 vUv3;\r\n\r\nvoid main() {\r\n\r\n\tvec2 dUv = (texelSize * vec2(kernel)) + halfTexelSize;\r\n\r\n\tvUv0 = vec2(uv.x - dUv.x, uv.y + dUv.y);\r\n\tvUv1 = vec2(uv.x + dUv.x, uv.y + dUv.y);\r\n\tvUv2 = vec2(uv.x + dUv.x, uv.y - dUv.y);\r\n\tvUv3 = vec2(uv.x - dUv.x, uv.y - dUv.y);\r\n\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var ConvolutionMaterial = function (_ShaderMaterial) {
  	inherits(ConvolutionMaterial, _ShaderMaterial);

  	function ConvolutionMaterial() {
  		var texelSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new three.Vector2();
  		classCallCheck(this, ConvolutionMaterial);

  		var _this = possibleConstructorReturn(this, (ConvolutionMaterial.__proto__ || Object.getPrototypeOf(ConvolutionMaterial)).call(this, {

  			type: "ConvolutionMaterial",

  			uniforms: {

  				tDiffuse: new three.Uniform(null),
  				texelSize: new three.Uniform(new three.Vector2()),
  				halfTexelSize: new three.Uniform(new three.Vector2()),
  				kernel: new three.Uniform(0.0)

  			},

  			fragmentShader: fragment$4,
  			vertexShader: vertex$4,

  			depthWrite: false,
  			depthTest: false

  		}));

  		_this.setTexelSize(texelSize.x, texelSize.y);

  		_this.kernelSize = KernelSize.LARGE;

  		return _this;
  	}

  	createClass(ConvolutionMaterial, [{
  		key: "getKernel",
  		value: function getKernel() {

  			return kernelPresets[this.kernelSize];
  		}
  	}, {
  		key: "setTexelSize",
  		value: function setTexelSize(x, y) {

  			this.uniforms.texelSize.value.set(x, y);
  			this.uniforms.halfTexelSize.value.set(x, y).multiplyScalar(0.5);
  		}
  	}]);
  	return ConvolutionMaterial;
  }(three.ShaderMaterial);

  var kernelPresets = [new Float32Array([0.0, 0.0]), new Float32Array([0.0, 1.0, 1.0]), new Float32Array([0.0, 1.0, 1.0, 2.0]), new Float32Array([0.0, 1.0, 2.0, 2.0, 3.0]), new Float32Array([0.0, 1.0, 2.0, 3.0, 4.0, 4.0, 5.0]), new Float32Array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 8.0, 9.0, 10.0])];

  var KernelSize = {

  	VERY_SMALL: 0,
  	SMALL: 1,
  	MEDIUM: 2,
  	LARGE: 3,
  	VERY_LARGE: 4,
  	HUGE: 5

  };

  var fragment$5 = "uniform sampler2D tDiffuse;\r\nuniform float opacity;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvec4 texel = texture2D(tDiffuse, vUv);\r\n\tgl_FragColor = opacity * texel;\r\n\r\n}\r\n";

  var vertex$5 = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var CopyMaterial = function (_ShaderMaterial) {
  			inherits(CopyMaterial, _ShaderMaterial);

  			function CopyMaterial() {
  						classCallCheck(this, CopyMaterial);
  						return possibleConstructorReturn(this, (CopyMaterial.__proto__ || Object.getPrototypeOf(CopyMaterial)).call(this, {

  									type: "CopyMaterial",

  									uniforms: {

  												tDiffuse: new three.Uniform(null),
  												opacity: new three.Uniform(1.0)

  									},

  									fragmentShader: fragment$5,
  									vertexShader: vertex$5,

  									depthWrite: false,
  									depthTest: false

  						}));
  			}

  			return CopyMaterial;
  }(three.ShaderMaterial);

  var fragment$6 = "uniform sampler2D tDiffuse;\r\n\r\nuniform float angle;\r\nuniform float scale;\r\nuniform float intensity;\r\n\r\nvarying vec2 vUv;\r\nvarying vec2 vUvPattern;\r\n\r\nfloat pattern() {\r\n\r\n\tfloat s = sin(angle);\r\n\tfloat c = cos(angle);\r\n\r\n\tvec2 point = vec2(c * vUvPattern.x - s * vUvPattern.y, s * vUvPattern.x + c * vUvPattern.y) * scale;\r\n\r\n\treturn (sin(point.x) * sin(point.y)) * 4.0;\r\n\r\n}\r\n\r\nvoid main() {\r\n\r\n\tvec4 texel = texture2D(tDiffuse, vUv);\r\n\tvec3 color = texel.rgb;\r\n\r\n\t#ifdef AVERAGE\r\n\r\n\t\tcolor = vec3((color.r + color.g + color.b) / 3.0);\r\n\r\n\t#endif\r\n\r\n\tcolor = vec3(color * 10.0 - 5.0 + pattern());\r\n\tcolor = texel.rgb + (color - texel.rgb) * intensity;\r\n\r\n\tgl_FragColor = vec4(color, texel.a);\r\n\r\n}\r\n";

  var vertex$6 = "uniform vec4 offsetRepeat;\r\n\r\nvarying vec2 vUv;\r\nvarying vec2 vUvPattern;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tvUvPattern = uv * offsetRepeat.zw + offsetRepeat.xy;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var DotScreenMaterial = function (_ShaderMaterial) {
  	inherits(DotScreenMaterial, _ShaderMaterial);

  	function DotScreenMaterial() {
  		var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  		classCallCheck(this, DotScreenMaterial);


  		var settings = Object.assign({
  			average: false,
  			angle: 1.57,
  			scale: 1.0,
  			intensity: 1.0
  		}, options);

  		var _this = possibleConstructorReturn(this, (DotScreenMaterial.__proto__ || Object.getPrototypeOf(DotScreenMaterial)).call(this, {

  			type: "DotScreenMaterial",

  			uniforms: {

  				tDiffuse: new three.Uniform(null),

  				angle: new three.Uniform(settings.angle),
  				scale: new three.Uniform(settings.scale),
  				intensity: new three.Uniform(settings.intensity),

  				offsetRepeat: new three.Uniform(new three.Vector4(0.5, 0.5, 1.0, 1.0))

  			},

  			fragmentShader: fragment$6,
  			vertexShader: vertex$6,

  			depthWrite: false,
  			depthTest: false

  		}));

  		_this.setAverageEnabled(settings.average);

  		return _this;
  	}

  	createClass(DotScreenMaterial, [{
  		key: "setAverageEnabled",
  		value: function setAverageEnabled(enabled) {

  			if (enabled) {

  				this.defines.AVERAGE = "1";
  			} else {

  				delete this.defines.AVERAGE;
  			}

  			this.needsUpdate = true;
  		}
  	}]);
  	return DotScreenMaterial;
  }(three.ShaderMaterial);

  var fragment$7 = "uniform sampler2D tDiffuse;\r\nuniform float time;\r\n\r\nvarying vec2 vUv;\r\n\r\n#ifdef NOISE\r\n\r\n\tuniform float noiseIntensity;\r\n\r\n#endif\r\n\r\n#ifdef SCANLINES\r\n\r\n\tuniform float scanlineIntensity;\r\n\tuniform float scanlineCount;\r\n\r\n#endif\r\n\r\n#ifdef GREYSCALE\r\n\r\n\t#include <common>\r\n\r\n\tuniform float greyscaleIntensity;\r\n\r\n#elif defined(SEPIA)\r\n\r\n\tuniform float sepiaIntensity;\r\n\r\n#endif\r\n\r\n#ifdef VIGNETTE\r\n\r\n\tuniform float vignetteOffset;\r\n\tuniform float vignetteDarkness;\r\n\r\n#endif\r\n\r\nvoid main() {\r\n\r\n\tvec4 texel = texture2D(tDiffuse, vUv);\r\n\tvec3 color = texel.rgb;\r\n\r\n\t#ifdef SCREEN_MODE\r\n\r\n\t\tvec3 invColor;\r\n\r\n\t#endif\r\n\r\n\t#ifdef NOISE\r\n\r\n\t\tfloat x = vUv.x * vUv.y * time * 1000.0;\r\n\t\tx = mod(x, 13.0) * mod(x, 123.0);\r\n\t\tx = mod(x, 0.01);\r\n\r\n\t\tvec3 noise = texel.rgb * clamp(0.1 + x * 100.0, 0.0, 1.0) * noiseIntensity;\r\n\r\n\t\t#ifdef SCREEN_MODE\r\n\r\n\t\t\tinvColor = vec3(1.0) - color;\r\n\t\t\tvec3 invNoise = vec3(1.0) - noise;\r\n\r\n\t\t\tcolor = vec3(1.0) - invColor * invNoise;\r\n\r\n\t\t#else\r\n\r\n\t\t\tcolor += noise;\r\n\r\n\t\t#endif\r\n\r\n\t#endif\r\n\r\n\t#ifdef SCANLINES\r\n\r\n\t\tvec2 sl = vec2(sin(vUv.y * scanlineCount), cos(vUv.y * scanlineCount));\r\n\t\tvec3 scanlines = texel.rgb * vec3(sl.x, sl.y, sl.x) * scanlineIntensity;\r\n\r\n\t\t#ifdef SCREEN_MODE\r\n\r\n\t\t\tinvColor = vec3(1.0) - color;\r\n\t\t\tvec3 invScanlines = vec3(1.0) - scanlines;\r\n\r\n\t\t\tcolor = vec3(1.0) - invColor * invScanlines;\r\n\r\n\t\t#else\r\n\r\n\t\t\tcolor += scanlines;\r\n\r\n\t\t#endif\r\n\r\n\t#endif\r\n\r\n\t#ifdef GREYSCALE\r\n\r\n\t\tcolor = mix(color, vec3(linearToRelativeLuminance(color)), greyscaleIntensity);\r\n\r\n\t#elif defined(SEPIA)\r\n\r\n\t\tvec3 c = color.rgb;\r\n\r\n\t\tcolor.r = dot(c, vec3(1.0 - 0.607 * sepiaIntensity, 0.769 * sepiaIntensity, 0.189 * sepiaIntensity));\r\n\t\tcolor.g = dot(c, vec3(0.349 * sepiaIntensity, 1.0 - 0.314 * sepiaIntensity, 0.168 * sepiaIntensity));\r\n\t\tcolor.b = dot(c, vec3(0.272 * sepiaIntensity, 0.534 * sepiaIntensity, 1.0 - 0.869 * sepiaIntensity));\r\n\r\n\t#endif\r\n\r\n\t#ifdef VIGNETTE\r\n\r\n\t\tconst vec2 center = vec2(0.5);\r\n\r\n\t\t#ifdef ESKIL\r\n\r\n\t\t\tvec2 uv = (vUv - center) * vec2(vignetteOffset);\r\n\t\t\tcolor = mix(color.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\r\n\r\n\t\t#else\r\n\r\n\t\t\tfloat dist = distance(vUv, center);\r\n\t\t\tcolor *= smoothstep(0.8, vignetteOffset * 0.799, dist * (vignetteDarkness + vignetteOffset));\r\n\r\n\t\t#endif\t\t\r\n\r\n\t#endif\r\n\r\n\tgl_FragColor = vec4(clamp(color, 0.0, 1.0), texel.a);\r\n\r\n}\r\n";

  var vertex$7 = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var FilmMaterial = function (_ShaderMaterial) {
  		inherits(FilmMaterial, _ShaderMaterial);

  		function FilmMaterial() {
  				var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  				classCallCheck(this, FilmMaterial);


  				var settings = Object.assign({

  						screenMode: true,
  						noise: true,
  						scanlines: true,

  						greyscale: false,
  						sepia: false,
  						vignette: false,
  						eskil: false,

  						noiseIntensity: 0.5,
  						scanlineIntensity: 0.05,
  						greyscaleIntensity: 1.0,
  						sepiaIntensity: 1.0,

  						vignetteOffset: 1.0,
  						vignetteDarkness: 1.0

  				}, options);

  				var _this = possibleConstructorReturn(this, (FilmMaterial.__proto__ || Object.getPrototypeOf(FilmMaterial)).call(this, {

  						type: "FilmMaterial",

  						uniforms: {

  								tDiffuse: new three.Uniform(null),
  								time: new three.Uniform(0.0),

  								noiseIntensity: new three.Uniform(settings.noiseIntensity),
  								scanlineIntensity: new three.Uniform(settings.scanlineIntensity),
  								scanlineCount: new three.Uniform(0.0),

  								greyscaleIntensity: new three.Uniform(settings.greyscaleIntensity),
  								sepiaIntensity: new three.Uniform(settings.sepiaIntensity),

  								vignetteOffset: new three.Uniform(settings.vignetteOffset),
  								vignetteDarkness: new three.Uniform(settings.vignetteDarkness)

  						},

  						fragmentShader: fragment$7,
  						vertexShader: vertex$7,

  						depthWrite: false,
  						depthTest: false

  				}));

  				_this.setScreenModeEnabled(settings.screenMode);
  				_this.setNoiseEnabled(settings.noise);
  				_this.setScanlinesEnabled(settings.scanlines);
  				_this.setGreyscaleEnabled(settings.greyscale);
  				_this.setSepiaEnabled(settings.sepia);
  				_this.setVignetteEnabled(settings.vignette);
  				_this.setEskilEnabled(settings.eskil);

  				return _this;
  		}

  		createClass(FilmMaterial, [{
  				key: "setScreenModeEnabled",
  				value: function setScreenModeEnabled(enabled) {

  						if (enabled) {

  								this.defines.SCREEN_MODE = "1";
  						} else {

  								delete this.defines.SCREEN_MODE;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setNoiseEnabled",
  				value: function setNoiseEnabled(enabled) {

  						if (enabled) {

  								this.defines.NOISE = "1";
  						} else {

  								delete this.defines.NOISE;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setScanlinesEnabled",
  				value: function setScanlinesEnabled(enabled) {

  						if (enabled) {

  								this.defines.SCANLINES = "1";
  						} else {

  								delete this.defines.SCANLINES;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setGreyscaleEnabled",
  				value: function setGreyscaleEnabled(enabled) {

  						if (enabled) {

  								this.defines.GREYSCALE = "1";
  						} else {

  								delete this.defines.GREYSCALE;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setSepiaEnabled",
  				value: function setSepiaEnabled(enabled) {

  						if (enabled) {

  								this.defines.SEPIA = "1";
  						} else {

  								delete this.defines.SEPIA;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setVignetteEnabled",
  				value: function setVignetteEnabled(enabled) {

  						if (enabled) {

  								this.defines.VIGNETTE = "1";
  						} else {

  								delete this.defines.VIGNETTE;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setEskilEnabled",
  				value: function setEskilEnabled(enabled) {

  						if (enabled) {

  								this.defines.ESKIL = "1";
  						} else {

  								delete this.defines.ESKIL;
  						}

  						this.needsUpdate = true;
  				}
  		}]);
  		return FilmMaterial;
  }(three.ShaderMaterial);

  var fragment$8 = "uniform sampler2D tDiffuse;\r\nuniform sampler2D tPerturb;\r\n\r\nuniform bool active;\r\n\r\nuniform float amount;\r\nuniform float angle;\r\nuniform float seed;\r\nuniform float seedX;\r\nuniform float seedY;\r\nuniform float distortionX;\r\nuniform float distortionY;\r\nuniform float colS;\r\n\r\nvarying vec2 vUv;\r\n\r\nfloat rand(vec2 tc) {\r\n\r\n\tconst float a = 12.9898;\r\n\tconst float b = 78.233;\r\n\tconst float c = 43758.5453;\r\n\r\n\tfloat dt = dot(tc, vec2(a, b));\r\n\tfloat sn = mod(dt, 3.14);\r\n\r\n\treturn fract(sin(sn) * c);\r\n\r\n}\r\n\r\nvoid main() {\r\n\r\n\tvec2 coord = vUv;\r\n\r\n\tfloat xs, ys;\r\n\tvec4 normal;\r\n\r\n\tvec2 offset;\r\n\tvec4 cr, cga, cb;\r\n\tvec4 snow, color;\r\n\r\n\tfloat sx, sy;\r\n\r\n\tif(active) {\r\n\r\n\t\txs = floor(gl_FragCoord.x / 0.5);\r\n\t\tys = floor(gl_FragCoord.y / 0.5);\r\n\r\n\t\tnormal = texture2D(tPerturb, coord * seed * seed);\r\n\r\n\t\tif(coord.y < distortionX + colS && coord.y > distortionX - colS * seed) {\r\n\r\n\t\t\tsx = clamp(ceil(seedX), 0.0, 1.0);\r\n\t\t\tcoord.y = sx * (1.0 - (coord.y + distortionY)) + (1.0 - sx) * distortionY;\r\n\r\n\t\t}\r\n\r\n\t\tif(coord.x < distortionY + colS && coord.x > distortionY - colS * seed) {\r\n\r\n\t\t\tsy = clamp(ceil(seedY), 0.0, 1.0);\r\n\t\t\tcoord.x = sy * distortionX + (1.0 - sy) * (1.0 - (coord.x + distortionX));\r\n\r\n\t\t}\r\n\r\n\t\tcoord.x += normal.x * seedX * (seed / 5.0);\r\n\t\tcoord.y += normal.y * seedY * (seed / 5.0);\r\n\r\n\t\toffset = amount * vec2(cos(angle), sin(angle));\r\n\r\n\t\tcr = texture2D(tDiffuse, coord + offset);\r\n\t\tcga = texture2D(tDiffuse, coord);\r\n\t\tcb = texture2D(tDiffuse, coord - offset);\r\n\r\n\t\tcolor = vec4(cr.r, cga.g, cb.b, cga.a);\r\n\t\tsnow = 200.0 * amount * vec4(rand(vec2(xs * seed, ys * seed * 50.0)) * 0.2);\r\n\t\tcolor += snow;\r\n\r\n\t} else {\r\n\r\n\t\tcolor = texture2D(tDiffuse, vUv);\r\n\r\n\t}\r\n\r\n\tgl_FragColor = color;\r\n\r\n}\r\n";

  var vertex$8 = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var GlitchMaterial = function (_ShaderMaterial) {
  			inherits(GlitchMaterial, _ShaderMaterial);

  			function GlitchMaterial() {
  						classCallCheck(this, GlitchMaterial);
  						return possibleConstructorReturn(this, (GlitchMaterial.__proto__ || Object.getPrototypeOf(GlitchMaterial)).call(this, {

  									type: "GlitchMaterial",

  									uniforms: {

  												tDiffuse: new three.Uniform(null),
  												tPerturb: new three.Uniform(null),

  												active: new three.Uniform(1),

  												amount: new three.Uniform(0.8),
  												angle: new three.Uniform(0.02),
  												seed: new three.Uniform(0.02),
  												seedX: new three.Uniform(0.02),
  												seedY: new three.Uniform(0.02),
  												distortionX: new three.Uniform(0.5),
  												distortionY: new three.Uniform(0.6),
  												colS: new three.Uniform(0.05)

  									},

  									fragmentShader: fragment$8,
  									vertexShader: vertex$8,

  									depthWrite: false,
  									depthTest: false

  						}));
  			}

  			return GlitchMaterial;
  }(three.ShaderMaterial);

  var fragment$9 = "uniform sampler2D tDiffuse;\r\nuniform vec3 lightPosition;\r\n\r\nuniform float exposure;\r\nuniform float decay;\r\nuniform float density;\r\nuniform float weight;\r\nuniform float clampMax;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvec2 texCoord = vUv;\r\n\r\n\t// Calculate vector from pixel to light source in screen space.\r\n\tvec2 deltaTexCoord = texCoord - lightPosition.st;\r\n\tdeltaTexCoord *= 1.0 / NUM_SAMPLES_FLOAT * density;\r\n\r\n\t// A decreasing illumination factor.\r\n\tfloat illuminationDecay = 1.0;\r\n\r\n\tvec4 sample;\r\n\tvec4 color = vec4(0.0);\r\n\r\n\t// Estimate the probability of occlusion at each pixel by summing samples along a ray to the light source.\r\n\tfor(int i = 0; i < NUM_SAMPLES_INT; ++i) {\r\n\r\n\t\ttexCoord -= deltaTexCoord;\r\n\t\tsample = texture2D(tDiffuse, texCoord);\r\n\r\n\t\t// Apply sample attenuation scale/decay factors.\r\n\t\tsample *= illuminationDecay * weight;\r\n\r\n\t\tcolor += sample;\r\n\r\n\t\t// Update exponential decay factor.\r\n\t\tilluminationDecay *= decay;\r\n\r\n\t}\r\n\r\n\tgl_FragColor = clamp(color * exposure, 0.0, clampMax);\r\n\r\n}\r\n";

  var vertex$9 = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var GodRaysMaterial = function (_ShaderMaterial) {
  			inherits(GodRaysMaterial, _ShaderMaterial);

  			function GodRaysMaterial() {
  						var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  						classCallCheck(this, GodRaysMaterial);


  						var settings = Object.assign({
  									exposure: 0.6,
  									density: 0.93,
  									decay: 0.96,
  									weight: 0.4,
  									clampMax: 1.0
  						}, options);

  						return possibleConstructorReturn(this, (GodRaysMaterial.__proto__ || Object.getPrototypeOf(GodRaysMaterial)).call(this, {

  									type: "GodRaysMaterial",

  									defines: {

  												NUM_SAMPLES_FLOAT: "60.0",
  												NUM_SAMPLES_INT: "60"

  									},

  									uniforms: {

  												tDiffuse: new three.Uniform(null),
  												lightPosition: new three.Uniform(null),

  												exposure: new three.Uniform(settings.exposure),
  												decay: new three.Uniform(settings.decay),
  												density: new three.Uniform(settings.density),
  												weight: new three.Uniform(settings.weight),
  												clampMax: new three.Uniform(settings.clampMax)

  									},

  									fragmentShader: fragment$9,
  									vertexShader: vertex$9,

  									depthWrite: false,
  									depthTest: false

  						}));
  			}

  			return GodRaysMaterial;
  }(three.ShaderMaterial);

  var fragment$10 = "#include <common>\r\n\r\nuniform sampler2D tDiffuse;\r\nuniform float distinction;\r\nuniform vec2 range;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvec4 texel = texture2D(tDiffuse, vUv);\r\n\tfloat l = linearToRelativeLuminance(texel.rgb);\r\n\r\n\t#ifdef RANGE\r\n\r\n\t\tfloat low = step(range.x, l);\r\n\t\tfloat high = step(l, range.y);\r\n\r\n\t\t// Apply the mask.\r\n\t\tl *= low * high;\r\n\r\n\t#endif\r\n\r\n\tl = pow(abs(l), distinction);\r\n\r\n\t#ifdef COLOR\r\n\r\n\t\tgl_FragColor = vec4(texel.rgb * l, texel.a);\r\n\r\n\t#else\r\n\r\n\t\tgl_FragColor = vec4(l, l, l, texel.a);\r\n\r\n\t#endif\r\n\r\n}\r\n";

  var vertex$10 = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var LuminosityMaterial = function (_ShaderMaterial) {
  		inherits(LuminosityMaterial, _ShaderMaterial);

  		function LuminosityMaterial() {
  				var colorOutput = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  				var luminanceRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  				classCallCheck(this, LuminosityMaterial);


  				var maskLuminance = luminanceRange !== null;

  				var _this = possibleConstructorReturn(this, (LuminosityMaterial.__proto__ || Object.getPrototypeOf(LuminosityMaterial)).call(this, {

  						type: "LuminosityMaterial",

  						uniforms: {

  								tDiffuse: new three.Uniform(null),
  								distinction: new three.Uniform(1.0),
  								range: new three.Uniform(maskLuminance ? luminanceRange : new three.Vector2())

  						},

  						fragmentShader: fragment$10,
  						vertexShader: vertex$10

  				}));

  				_this.setColorOutputEnabled(colorOutput);
  				_this.setLuminanceRangeEnabled(maskLuminance);

  				return _this;
  		}

  		createClass(LuminosityMaterial, [{
  				key: "setColorOutputEnabled",
  				value: function setColorOutputEnabled(enabled) {

  						if (enabled) {

  								this.defines.COLOR = "1";
  						} else {

  								delete this.defines.COLOR;
  						}

  						this.needsUpdate = true;
  				}
  		}, {
  				key: "setLuminanceRangeEnabled",
  				value: function setLuminanceRangeEnabled(enabled) {

  						if (enabled) {

  								this.defines.RANGE = "1";
  						} else {

  								delete this.defines.RANGE;
  						}

  						this.needsUpdate = true;
  				}
  		}]);
  		return LuminosityMaterial;
  }(three.ShaderMaterial);

  var fragment$11 = "uniform sampler2D tDiffuse;\r\nuniform float granularity;\r\nuniform float dx;\r\nuniform float dy;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvec4 texel;\r\n\r\n\tif(granularity > 0.0) {\r\n\r\n\t\tvec2 coord = vec2(\r\n\t\t\tdx * (floor(vUv.x / dx) + 0.5),\r\n\t\t\tdy * (floor(vUv.y / dy) + 0.5)\r\n\t\t);\r\n\r\n\t\ttexel = texture2D(tDiffuse, coord);\r\n\r\n\t} else {\r\n\r\n\t\ttexel = texture2D(tDiffuse, vUv);\r\n\r\n\t}\r\n\r\n\tgl_FragColor = texel;\r\n\r\n}\r\n";

  var vertex$11 = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var PixelationMaterial = function (_ShaderMaterial) {
  	inherits(PixelationMaterial, _ShaderMaterial);

  	function PixelationMaterial() {
  		classCallCheck(this, PixelationMaterial);
  		return possibleConstructorReturn(this, (PixelationMaterial.__proto__ || Object.getPrototypeOf(PixelationMaterial)).call(this, {

  			type: "PixelationMaterial",

  			uniforms: {

  				tDiffuse: new three.Uniform(null),
  				granularity: new three.Uniform(1.0),
  				resolution: new three.Uniform(new three.Vector2(1.0, 1.0)),
  				dx: new three.Uniform(1.0),
  				dy: new three.Uniform(1.0)

  			},

  			fragmentShader: fragment$11,
  			vertexShader: vertex$11,

  			depthWrite: false,
  			depthTest: false

  		}));
  	}

  	createClass(PixelationMaterial, [{
  		key: "setResolution",
  		value: function setResolution(width, height) {

  			this.uniforms.resolution.value.set(width, height);
  			this.granularity = this.granularity;
  		}
  	}, {
  		key: "granularity",
  		get: function get$$1() {

  			return this.uniforms.granularity.value;
  		},
  		set: function set$$1(x) {

  			var uniforms = this.uniforms;
  			var resolution = uniforms.resolution.value;

  			uniforms.granularity.value = x;
  			uniforms.dx.value = x / resolution.x;
  			uniforms.dy.value = x / resolution.y;
  		}
  	}]);
  	return PixelationMaterial;
  }(three.ShaderMaterial);

  var fragment$12 = "#include <common>\r\n\r\nuniform sampler2D tDiffuse;\r\nuniform vec2 center;\r\nuniform float aspect;\r\nuniform float waveSize;\r\nuniform float radius;\r\nuniform float maxRadius;\r\nuniform float amplitude;\r\n\r\nvarying vec2 vUv;\r\nvarying float vSize;\r\n\r\nvoid main() {\r\n\r\n\tvec2 aspectCorrection = vec2(aspect, 1.0);\r\n\r\n\tvec2 difference = vUv * aspectCorrection - center * aspectCorrection;\r\n\tfloat distance = sqrt(dot(difference, difference)) * vSize;\r\n\r\n\tvec2 displacement = vec2(0.0);\r\n\r\n\tif(distance > radius) {\r\n\r\n\t\tif(distance < radius + waveSize) {\r\n\r\n\t\t\tfloat angle = (distance - radius) * PI2 / waveSize;\r\n\t\t\tfloat cosSin = (1.0 - cos(angle)) * 0.5;\r\n\r\n\t\t\tfloat extent = maxRadius + waveSize;\r\n\t\t\tfloat decay = max(extent - distance * distance, 0.0) / extent;\r\n\r\n\t\t\tdisplacement = ((cosSin * amplitude * difference) / distance) * decay;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tgl_FragColor = texture2D(tDiffuse, vUv - displacement);\r\n\r\n}\r\n";

  var vertex$12 = "uniform float size;\r\nuniform float scale;\r\nuniform float cameraDistance;\r\n\r\nvarying vec2 vUv;\r\nvarying float vSize;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tvSize = (0.1 * cameraDistance) / size;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var ShockWaveMaterial = function (_ShaderMaterial) {
  	inherits(ShockWaveMaterial, _ShaderMaterial);

  	function ShockWaveMaterial() {
  		var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  		classCallCheck(this, ShockWaveMaterial);


  		var settings = Object.assign({
  			maxRadius: 1.0,
  			waveSize: 0.2,
  			amplitude: 0.05
  		}, options);

  		return possibleConstructorReturn(this, (ShockWaveMaterial.__proto__ || Object.getPrototypeOf(ShockWaveMaterial)).call(this, {

  			type: "ShockWaveMaterial",

  			uniforms: {

  				tDiffuse: new three.Uniform(null),

  				center: new three.Uniform(new three.Vector2(0.5, 0.5)),
  				aspect: new three.Uniform(1.0),
  				cameraDistance: new three.Uniform(1.0),

  				size: new three.Uniform(1.0),
  				radius: new three.Uniform(-settings.waveSize),
  				maxRadius: new three.Uniform(settings.maxRadius),
  				waveSize: new three.Uniform(settings.waveSize),
  				amplitude: new three.Uniform(settings.amplitude)

  			},

  			fragmentShader: fragment$12,
  			vertexShader: vertex$12,

  			depthWrite: false,
  			depthTest: false

  		}));
  	}

  	return ShockWaveMaterial;
  }(three.ShaderMaterial);

  var fragment$13 = "uniform sampler2D tDiffuse;\r\nuniform sampler2D tWeights;\r\n\r\nuniform vec2 texelSize;\r\n\r\nvarying vec2 vUv;\r\nvarying vec4 vOffset;\r\n\r\nvoid main() {\r\n\r\n\t// Fetch the blending weights for current pixel.\r\n\tvec4 a;\r\n\ta.xz = texture2D(tWeights, vUv).xz;\r\n\ta.y = texture2D(tWeights, vOffset.zw).g;\r\n\ta.w = texture2D(tWeights, vOffset.xy).a;\r\n\r\n\tvec4 color;\r\n\r\n\t// Check if there is any blending weight with a value greater than 0.0.\r\n\tif(dot(a, vec4(1.0)) < 1e-5) {\r\n\r\n\t\tcolor = texture2D(tDiffuse, vUv, 0.0);\r\n\r\n\t} else {\r\n\r\n\t\t/* Up to four lines can be crossing a pixel (one through each edge).\r\n\t\t * The line with the maximum weight for each direction is favoured.\r\n\t\t */\r\n\r\n\t\tvec2 offset;\r\n\t\toffset.x = a.a > a.b ? a.a : -a.b; // Left vs. right.\r\n\t\toffset.y = a.g > a.r ? -a.g : a.r; // Top vs. bottom (changed signs).\r\n\r\n\t\t// Go in the direction with the maximum weight (horizontal vs. vertical).\r\n\t\tif(abs(offset.x) > abs(offset.y)) {\r\n\r\n\t\t\toffset.y = 0.0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\toffset.x = 0.0;\r\n\r\n\t\t}\r\n\r\n\t\t// Fetch the opposite color and lerp by hand.\r\n\t\tcolor = texture2D(tDiffuse, vUv, 0.0);\r\n\t\tvec2 coord = vUv + sign(offset) * texelSize;\r\n\t\tvec4 oppositeColor = texture2D(tDiffuse, coord, 0.0);\r\n\t\tfloat s = abs(offset.x) > abs(offset.y) ? abs(offset.x) : abs(offset.y);\r\n\r\n\t\t// Gamma correction.\r\n\t\tcolor.rgb = pow(abs(color.rgb), vec3(2.2));\r\n\t\toppositeColor.rgb = pow(abs(oppositeColor.rgb), vec3(2.2));\r\n\t\tcolor = mix(color, oppositeColor, s);\r\n\t\tcolor.rgb = pow(abs(color.rgb), vec3(1.0 / 2.2));\r\n\r\n\t}\r\n\r\n\tgl_FragColor = color;\r\n\r\n}\r\n";

  var vertex$13 = "uniform vec2 texelSize;\r\n\r\nvarying vec2 vUv;\r\nvarying vec4 vOffset;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\r\n\tvOffset = uv.xyxy + texelSize.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // Changed sign in W component.\r\n\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var SMAABlendMaterial = function (_ShaderMaterial) {
  			inherits(SMAABlendMaterial, _ShaderMaterial);

  			function SMAABlendMaterial() {
  						var texelSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new three.Vector2();
  						classCallCheck(this, SMAABlendMaterial);
  						return possibleConstructorReturn(this, (SMAABlendMaterial.__proto__ || Object.getPrototypeOf(SMAABlendMaterial)).call(this, {

  									type: "SMAABlendMaterial",

  									uniforms: {

  												tDiffuse: new three.Uniform(null),
  												tWeights: new three.Uniform(null),
  												texelSize: new three.Uniform(texelSize)

  									},

  									fragmentShader: fragment$13,
  									vertexShader: vertex$13,

  									depthWrite: false,
  									depthTest: false

  						}));
  			}

  			return SMAABlendMaterial;
  }(three.ShaderMaterial);

  var fragment$14 = "uniform sampler2D tDiffuse;\r\n\r\nvarying vec2 vUv;\r\nvarying vec4 vOffset[3];\r\n\r\nvoid main() {\r\n\r\n\tconst vec2 threshold = vec2(EDGE_THRESHOLD);\r\n\r\n\t// Calculate color deltas.\r\n\tvec4 delta;\r\n\tvec3 c = texture2D(tDiffuse, vUv).rgb;\r\n\r\n\tvec3 cLeft = texture2D(tDiffuse, vOffset[0].xy).rgb;\r\n\tvec3 t = abs(c - cLeft);\r\n\tdelta.x = max(max(t.r, t.g), t.b);\r\n\r\n\tvec3 cTop = texture2D(tDiffuse, vOffset[0].zw).rgb;\r\n\tt = abs(c - cTop);\r\n\tdelta.y = max(max(t.r, t.g), t.b);\r\n\r\n\t// We do the usual threshold.\r\n\tvec2 edges = step(threshold, delta.xy);\r\n\r\n\t// Then discard if there is no edge.\r\n\tif(dot(edges, vec2(1.0)) == 0.0) {\r\n\r\n\t\tdiscard;\r\n\r\n\t}\r\n\r\n\t// Calculate right and bottom deltas.\r\n\tvec3 cRight = texture2D(tDiffuse, vOffset[1].xy).rgb;\r\n\tt = abs(c - cRight);\r\n\tdelta.z = max(max(t.r, t.g), t.b);\r\n\r\n\tvec3 cBottom = texture2D(tDiffuse, vOffset[1].zw).rgb;\r\n\tt = abs(c - cBottom);\r\n\tdelta.w = max(max(t.r, t.g), t.b);\r\n\r\n\t// Calculate the maximum delta in the direct neighborhood.\r\n\tfloat maxDelta = max(max(max(delta.x, delta.y), delta.z), delta.w);\r\n\r\n\t// Calculate left-left and top-top deltas.\r\n\tvec3 cLeftLeft = texture2D(tDiffuse, vOffset[2].xy).rgb;\r\n\tt = abs(c - cLeftLeft);\r\n\tdelta.z = max(max(t.r, t.g), t.b);\r\n\r\n\tvec3 cTopTop = texture2D(tDiffuse, vOffset[2].zw).rgb;\r\n\tt = abs(c - cTopTop);\r\n\tdelta.w = max(max(t.r, t.g), t.b);\r\n\r\n\t// Calculate the final maximum delta.\r\n\tmaxDelta = max(max(maxDelta, delta.z), delta.w);\r\n\r\n\t// Local contrast adaptation in action.\r\n\tedges.xy *= step(0.5 * maxDelta, delta.xy);\r\n\r\n\tgl_FragColor = vec4(edges, 0.0, 0.0);\r\n\r\n}\r\n";

  var vertex$14 = "uniform vec2 texelSize;\r\n\r\nvarying vec2 vUv;\r\nvarying vec4 vOffset[3];\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\r\n\tvOffset[0] = uv.xyxy + texelSize.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // Changed sign in W component.\r\n\tvOffset[1] = uv.xyxy + texelSize.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // Changed sign in W component.\r\n\tvOffset[2] = uv.xyxy + texelSize.xyxy * vec4(-2.0, 0.0, 0.0, 2.0); // Changed sign in W component.\r\n\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var SMAAColorEdgesMaterial = function (_ShaderMaterial) {
  	inherits(SMAAColorEdgesMaterial, _ShaderMaterial);

  	function SMAAColorEdgesMaterial() {
  		var texelSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new three.Vector2();
  		classCallCheck(this, SMAAColorEdgesMaterial);
  		return possibleConstructorReturn(this, (SMAAColorEdgesMaterial.__proto__ || Object.getPrototypeOf(SMAAColorEdgesMaterial)).call(this, {

  			type: "SMAAColorEdgesMaterial",

  			defines: {

  				EDGE_THRESHOLD: "0.1"

  			},

  			uniforms: {

  				tDiffuse: new three.Uniform(null),
  				texelSize: new three.Uniform(texelSize)

  			},

  			fragmentShader: fragment$14,
  			vertexShader: vertex$14,

  			depthWrite: false,
  			depthTest: false

  		}));
  	}

  	createClass(SMAAColorEdgesMaterial, [{
  		key: "setEdgeDetectionThreshold",
  		value: function setEdgeDetectionThreshold(threshold) {

  			this.defines.EDGE_THRESHOLD = threshold.toFixed("2");

  			this.needsUpdate = true;
  		}
  	}]);
  	return SMAAColorEdgesMaterial;
  }(three.ShaderMaterial);

  var fragment$15 = "#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + float(offset) * texelSize, 0.0)\r\n\r\nuniform sampler2D tDiffuse;\r\nuniform sampler2D tArea;\r\nuniform sampler2D tSearch;\r\n\r\nuniform vec2 texelSize;\r\n\r\nvarying vec2 vUv;\r\nvarying vec4 vOffset[3];\r\nvarying vec2 vPixCoord;\r\n\r\nvec2 round(vec2 x) {\r\n\r\n\treturn sign(x) * floor(abs(x) + 0.5);\r\n\r\n}\r\n\r\nfloat searchLength(vec2 e, float bias, float scale) {\r\n\r\n\t// Not required if tSearch accesses are set to point.\r\n\t// const vec2 SEARCH_TEX_PIXEL_SIZE = 1.0 / vec2(66.0, 33.0);\r\n\t// e = vec2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE + e * vec2(scale, 1.0) * vec2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;\r\n\r\n\te.r = bias + e.r * scale;\r\n\r\n\treturn 255.0 * texture2D(tSearch, e, 0.0).r;\r\n\r\n}\r\n\r\nfloat searchXLeft(vec2 texCoord, float end) {\r\n\r\n\t/* @PSEUDO_GATHER4\r\n\t * This texCoord has been offset by (-0.25, -0.125) in the vertex shader to\r\n\t * sample between edge, thus fetching four edges in a row.\r\n\t * Sampling with different offsets in each direction allows to disambiguate\r\n\t * which edges are active from the four fetched ones.\r\n\t */\r\n\r\n\tvec2 e = vec2(0.0, 1.0);\r\n\r\n\tfor(int i = 0; i < MAX_SEARCH_STEPS_INT; ++i) {\r\n\r\n\t\te = texture2D(tDiffuse, texCoord, 0.0).rg;\r\n\t\ttexCoord -= vec2(2.0, 0.0) * texelSize;\r\n\r\n\t\tif(!(texCoord.x > end && e.g > 0.8281 && e.r == 0.0)) { break; }\r\n\r\n\t}\r\n\r\n\t// Correct the previously applied offset (-0.25, -0.125).\r\n\ttexCoord.x += 0.25 * texelSize.x;\r\n\r\n\t// The searches are biased by 1, so adjust the coords accordingly.\r\n\ttexCoord.x += texelSize.x;\r\n\r\n\t// Disambiguate the length added by the last step.\r\n\ttexCoord.x += 2.0 * texelSize.x; // Undo last step.\r\n\ttexCoord.x -= texelSize.x * searchLength(e, 0.0, 0.5);\r\n\r\n\treturn texCoord.x;\r\n\r\n}\r\n\r\nfloat searchXRight(vec2 texCoord, float end) {\r\n\r\n\tvec2 e = vec2(0.0, 1.0);\r\n\r\n\tfor(int i = 0; i < MAX_SEARCH_STEPS_INT; ++i) {\r\n\r\n\t\te = texture2D(tDiffuse, texCoord, 0.0).rg;\r\n\t\ttexCoord += vec2(2.0, 0.0) * texelSize;\r\n\r\n\t\tif(!(texCoord.x < end && e.g > 0.8281 && e.r == 0.0)) { break; }\r\n\r\n\t}\r\n\r\n\ttexCoord.x -= 0.25 * texelSize.x;\r\n\ttexCoord.x -= texelSize.x;\r\n\ttexCoord.x -= 2.0 * texelSize.x;\r\n\ttexCoord.x += texelSize.x * searchLength(e, 0.5, 0.5);\r\n\r\n\treturn texCoord.x;\r\n\r\n}\r\n\r\nfloat searchYUp(vec2 texCoord, float end) {\r\n\r\n\tvec2 e = vec2(1.0, 0.0);\r\n\r\n\tfor(int i = 0; i < MAX_SEARCH_STEPS_INT; ++i) {\r\n\r\n\t\te = texture2D(tDiffuse, texCoord, 0.0).rg;\r\n\t\ttexCoord += vec2(0.0, 2.0) * texelSize; // Changed sign.\r\n\r\n\t\tif(!(texCoord.y > end && e.r > 0.8281 && e.g == 0.0)) { break; }\r\n\r\n\t}\r\n\r\n\ttexCoord.y -= 0.25 * texelSize.y; // Changed sign.\r\n\ttexCoord.y -= texelSize.y; // Changed sign.\r\n\ttexCoord.y -= 2.0 * texelSize.y; // Changed sign.\r\n\ttexCoord.y += texelSize.y * searchLength(e.gr, 0.0, 0.5); // Changed sign.\r\n\r\n\treturn texCoord.y;\r\n\r\n}\r\n\r\nfloat searchYDown(vec2 texCoord, float end) {\r\n\r\n\tvec2 e = vec2(1.0, 0.0);\r\n\r\n\tfor(int i = 0; i < MAX_SEARCH_STEPS_INT; ++i ) {\r\n\r\n\t\te = texture2D(tDiffuse, texCoord, 0.0).rg;\r\n\t\ttexCoord -= vec2(0.0, 2.0) * texelSize; // Changed sign.\r\n\r\n\t\tif(!(texCoord.y < end && e.r > 0.8281 && e.g == 0.0)) { break; }\r\n\r\n\t}\r\n\r\n\ttexCoord.y += 0.25 * texelSize.y; // Changed sign.\r\n\ttexCoord.y += texelSize.y; // Changed sign.\r\n\ttexCoord.y += 2.0 * texelSize.y; // Changed sign.\r\n\ttexCoord.y -= texelSize.y * searchLength(e.gr, 0.5, 0.5); // Changed sign.\r\n\r\n\treturn texCoord.y;\r\n\r\n}\r\n\r\nvec2 area(vec2 dist, float e1, float e2, float offset) {\r\n\r\n\t// Rounding prevents precision errors of bilinear filtering.\r\n\tvec2 texCoord = AREATEX_MAX_DISTANCE * round(4.0 * vec2(e1, e2)) + dist;\r\n\r\n\t// Scale and bias for texel space translation.\r\n\ttexCoord = AREATEX_PIXEL_SIZE * texCoord + (0.5 * AREATEX_PIXEL_SIZE);\r\n\r\n\t// Move to proper place, according to the subpixel offset.\r\n\ttexCoord.y += AREATEX_SUBTEX_SIZE * offset;\r\n\r\n\treturn texture2D(tArea, texCoord, 0.0).rg;\r\n\r\n}\r\n\r\nvoid main() {\r\n\r\n\tvec4 weights = vec4(0.0);\r\n\tvec4 subsampleIndices = vec4(0.0);\r\n\tvec2 e = texture2D(tDiffuse, vUv).rg;\r\n\r\n\tif(e.g > 0.0) {\r\n\r\n\t\t// Edge at north.\r\n\t\tvec2 d;\r\n\r\n\t\t// Find the distance to the left.\r\n\t\tvec2 coords;\r\n\t\tcoords.x = searchXLeft(vOffset[0].xy, vOffset[2].x);\r\n\t\tcoords.y = vOffset[1].y; // vOffset[1].y = vUv.y - 0.25 * texelSize.y (@CROSSING_OFFSET)\r\n\t\td.x = coords.x;\r\n\r\n\t\t/* Now fetch the left crossing edges, two at a time using bilinear\r\n\t\tfiltering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to discern what\r\n\t\tvalue each edge has. */\r\n\t\tfloat e1 = texture2D(tDiffuse, coords, 0.0).r;\r\n\r\n\t\t// Find the distance to the right.\r\n\t\tcoords.x = searchXRight(vOffset[0].zw, vOffset[2].y);\r\n\t\td.y = coords.x;\r\n\r\n\t\t/* Translate distances to pixel units for better interleave arithmetic and\r\n\t\tmemory accesses. */\r\n\t\td = d / texelSize.x - vPixCoord.x;\r\n\r\n\t\t// The area texture is compressed quadratically.\r\n\t\tvec2 sqrtD = sqrt(abs(d));\r\n\r\n\t\t// Fetch the right crossing edges.\r\n\t\tcoords.y -= texelSize.y; // WebGL port note: Added.\r\n\t\tfloat e2 = sampleLevelZeroOffset(tDiffuse, coords, ivec2(1, 0)).r;\r\n\r\n\t\t// Pattern recognised, now get the actual area.\r\n\t\tweights.rg = area(sqrtD, e1, e2, subsampleIndices.y);\r\n\r\n\t}\r\n\r\n\tif(e.r > 0.0) {\r\n\r\n\t\t// Edge at west.\r\n\t\tvec2 d;\r\n\r\n\t\t// Find the distance to the top.\r\n\t\tvec2 coords;\r\n\t\tcoords.y = searchYUp(vOffset[1].xy, vOffset[2].z);\r\n\t\tcoords.x = vOffset[0].x; // vOffset[1].x = vUv.x - 0.25 * texelSize.x;\r\n\t\td.x = coords.y;\r\n\r\n\t\t// Fetch the top crossing edges.\r\n\t\tfloat e1 = texture2D(tDiffuse, coords, 0.0).g;\r\n\r\n\t\t// Find the distance to the bottom.\r\n\t\tcoords.y = searchYDown(vOffset[1].zw, vOffset[2].w);\r\n\t\td.y = coords.y;\r\n\r\n\t\t// Distances in pixel units.\r\n\t\td = d / texelSize.y - vPixCoord.y;\r\n\r\n\t\t// The area texture is compressed quadratically.\r\n\t\tvec2 sqrtD = sqrt(abs(d));\r\n\r\n\t\t// Fetch the bottom crossing edges.\r\n\t\tcoords.y -= texelSize.y; // WebGL port note: Added.\r\n\t\tfloat e2 = sampleLevelZeroOffset(tDiffuse, coords, ivec2(0, 1)).g;\r\n\r\n\t\t// Get the area for this direction.\r\n\t\tweights.ba = area(sqrtD, e1, e2, subsampleIndices.x);\r\n\r\n\t}\r\n\r\n\tgl_FragColor = weights;\r\n\r\n}\r\n";

  var vertex$15 = "uniform vec2 texelSize;\r\n\r\nvarying vec2 vUv;\r\nvarying vec4 vOffset[3];\r\nvarying vec2 vPixCoord;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\r\n\tvPixCoord = uv / texelSize;\r\n\r\n\t// Offsets for the searches (see @PSEUDO_GATHER4).\r\n\tvOffset[0] = uv.xyxy + texelSize.xyxy * vec4(-0.25, 0.125, 1.25, 0.125); // Changed sign in Y and W components.\r\n\tvOffset[1] = uv.xyxy + texelSize.xyxy * vec4(-0.125, 0.25, -0.125, -1.25); //Changed sign in Y and W components.\r\n\r\n\t// This indicates the ends of the loops.\r\n\tvOffset[2] = vec4(vOffset[0].xz, vOffset[1].yw) + vec4(-2.0, 2.0, -2.0, 2.0) * texelSize.xxyy * MAX_SEARCH_STEPS_FLOAT;\r\n\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var SMAAWeightsMaterial = function (_ShaderMaterial) {
  	inherits(SMAAWeightsMaterial, _ShaderMaterial);

  	function SMAAWeightsMaterial() {
  		var texelSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new three.Vector2();
  		classCallCheck(this, SMAAWeightsMaterial);
  		return possibleConstructorReturn(this, (SMAAWeightsMaterial.__proto__ || Object.getPrototypeOf(SMAAWeightsMaterial)).call(this, {

  			type: "SMAAWeightsMaterial",

  			defines: {
  				MAX_SEARCH_STEPS_INT: "8",
  				MAX_SEARCH_STEPS_FLOAT: "8.0",

  				AREATEX_MAX_DISTANCE: "16.0",
  				AREATEX_PIXEL_SIZE: "(1.0 / vec2(160.0, 560.0))",
  				AREATEX_SUBTEX_SIZE: "(1.0 / 7.0)",
  				SEARCHTEX_SIZE: "vec2(66.0, 33.0)",
  				SEARCHTEX_PACKED_SIZE: "vec2(64.0, 16.0)"

  			},

  			uniforms: {

  				tDiffuse: new three.Uniform(null),
  				tArea: new three.Uniform(null),
  				tSearch: new three.Uniform(null),
  				texelSize: new three.Uniform(texelSize)

  			},

  			fragmentShader: fragment$15,
  			vertexShader: vertex$15,

  			depthWrite: false,
  			depthTest: false

  		}));
  	}

  	createClass(SMAAWeightsMaterial, [{
  		key: "setOrthogonalSearchSteps",
  		value: function setOrthogonalSearchSteps(steps) {

  			this.defines.MAX_SEARCH_STEPS_INT = steps.toFixed("0");
  			this.defines.MAX_SEARCH_STEPS_FLOAT = steps.toFixed("1");

  			this.needsUpdate = true;
  		}
  	}]);
  	return SMAAWeightsMaterial;
  }(three.ShaderMaterial);

  var fragment$16 = "#include <common>\r\n\r\nuniform sampler2D tDiffuse;\r\nuniform float middleGrey;\r\nuniform float maxLuminance;\r\n\r\n#ifdef ADAPTED_LUMINANCE\r\n\r\n\tuniform sampler2D luminanceMap;\r\n\r\n#else\r\n\r\n\tuniform float averageLuminance;\r\n\r\n#endif\r\n\r\nvarying vec2 vUv;\r\n\r\nvec3 toneMap(vec3 c) {\r\n\r\n\t#ifdef ADAPTED_LUMINANCE\r\n\r\n\t\t// Get the calculated average luminance by sampling the center.\r\n\t\tfloat lumAvg = texture2D(luminanceMap, vec2(0.5)).r;\r\n\r\n\t#else\r\n\r\n\t\tfloat lumAvg = averageLuminance;\r\n\r\n\t#endif\r\n\r\n\t// Calculate the luminance of the current pixel.\r\n\tfloat lumPixel = linearToRelativeLuminance(c);\r\n\r\n\t// Apply the modified operator (Reinhard Eq. 4).\r\n\tfloat lumScaled = (lumPixel * middleGrey) / lumAvg;\r\n\r\n\tfloat lumCompressed = (lumScaled * (1.0 + (lumScaled / (maxLuminance * maxLuminance)))) / (1.0 + lumScaled);\r\n\r\n\treturn lumCompressed * c;\r\n\r\n}\r\n\r\nvoid main() {\r\n\r\n\tvec4 texel = texture2D(tDiffuse, vUv);\r\n\tgl_FragColor = vec4(toneMap(texel.rgb), texel.a);\r\n\r\n}\r\n";

  var vertex$16 = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n";

  var ToneMappingMaterial = function (_ShaderMaterial) {
  			inherits(ToneMappingMaterial, _ShaderMaterial);

  			function ToneMappingMaterial() {
  						classCallCheck(this, ToneMappingMaterial);
  						return possibleConstructorReturn(this, (ToneMappingMaterial.__proto__ || Object.getPrototypeOf(ToneMappingMaterial)).call(this, {

  									type: "ToneMappingMaterial",

  									uniforms: {

  												tDiffuse: new three.Uniform(null),
  												luminanceMap: new three.Uniform(null),
  												averageLuminance: new three.Uniform(1.0),
  												maxLuminance: new three.Uniform(16.0),
  												middleGrey: new three.Uniform(0.6)

  									},

  									fragmentShader: fragment$16,
  									vertexShader: vertex$16,

  									depthWrite: false,
  									depthTest: false

  						}));
  			}

  			return ToneMappingMaterial;
  }(three.ShaderMaterial);

  var Pass = function () {
  		function Pass() {
  				var scene = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new three.Scene();
  				var camera = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new three.OrthographicCamera(-1, 1, 1, -1, 0, 1);
  				var quad = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new three.Mesh(new three.PlaneBufferGeometry(2, 2), null);
  				classCallCheck(this, Pass);


  				this.name = "Pass";

  				this.scene = scene;

  				this.camera = camera;

  				this.quad = quad;

  				if (this.quad !== null) {

  						this.quad.frustumCulled = false;

  						if (this.scene !== null) {

  								this.scene.add(this.quad);
  						}
  				}

  				this.needsSwap = false;

  				this.enabled = true;

  				this.renderToScreen = false;
  		}

  		createClass(Pass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer, delta, maskActive) {

  						throw new Error("Render method not implemented!");
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {}
  		}, {
  				key: "initialise",
  				value: function initialise(renderer, alpha) {}
  		}, {
  				key: "dispose",
  				value: function dispose() {

  						var keys = Object.keys(this);

  						var key = void 0;

  						var _iteratorNormalCompletion = true;
  						var _didIteratorError = false;
  						var _iteratorError = undefined;

  						try {
  								for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  										key = _step.value;


  										if (this[key] !== null && typeof this[key].dispose === "function") {

  												this[key].dispose();
  												this[key] = null;
  										}
  								}
  						} catch (err) {
  								_didIteratorError = true;
  								_iteratorError = err;
  						} finally {
  								try {
  										if (!_iteratorNormalCompletion && _iterator.return) {
  												_iterator.return();
  										}
  								} finally {
  										if (_didIteratorError) {
  												throw _iteratorError;
  										}
  								}
  						}
  				}
  		}]);
  		return Pass;
  }();

  var BlurPass = function (_Pass) {
  		inherits(BlurPass, _Pass);

  		function BlurPass() {
  				var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  				classCallCheck(this, BlurPass);

  				var _this = possibleConstructorReturn(this, (BlurPass.__proto__ || Object.getPrototypeOf(BlurPass)).call(this));

  				_this.name = "BlurPass";

  				_this.needsSwap = true;

  				_this.renderTargetX = new three.WebGLRenderTarget(1, 1, {
  						minFilter: three.LinearFilter,
  						magFilter: three.LinearFilter,
  						stencilBuffer: false,
  						depthBuffer: false
  				});

  				_this.renderTargetX.texture.name = "Blur.TargetX";
  				_this.renderTargetX.texture.generateMipmaps = false;

  				_this.renderTargetY = _this.renderTargetX.clone();

  				_this.renderTargetY.texture.name = "Blur.TargetY";

  				_this.resolutionScale = options.resolutionScale !== undefined ? options.resolutionScale : 0.5;

  				_this.convolutionMaterial = new ConvolutionMaterial();

  				_this.kernelSize = options.kernelSize;

  				_this.quad.material = _this.convolutionMaterial;

  				return _this;
  		}

  		createClass(BlurPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer) {

  						var scene = this.scene;
  						var camera = this.camera;

  						var renderTargetX = this.renderTargetX;
  						var renderTargetY = this.renderTargetY;

  						var material = this.convolutionMaterial;
  						var uniforms = material.uniforms;
  						var kernel = material.getKernel();

  						var lastRT = readBuffer;
  						var destRT = void 0;
  						var i = void 0,
  						    l = void 0;

  						for (i = 0, l = kernel.length - 1; i < l; ++i) {
  								destRT = i % 2 === 0 ? renderTargetX : renderTargetY;

  								uniforms.kernel.value = kernel[i];
  								uniforms.tDiffuse.value = lastRT.texture;
  								renderer.render(scene, camera, destRT);

  								lastRT = destRT;
  						}

  						uniforms.kernel.value = kernel[i];
  						uniforms.tDiffuse.value = lastRT.texture;
  						renderer.render(scene, camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "initialise",
  				value: function initialise(renderer, alpha) {

  						if (!alpha) {

  								this.renderTargetX.texture.format = three.RGBFormat;
  								this.renderTargetY.texture.format = three.RGBFormat;
  						}
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						width = Math.max(1, Math.floor(width * this.resolutionScale));
  						height = Math.max(1, Math.floor(height * this.resolutionScale));

  						this.renderTargetX.setSize(width, height);
  						this.renderTargetY.setSize(width, height);

  						this.convolutionMaterial.setTexelSize(1.0 / width, 1.0 / height);
  				}
  		}, {
  				key: "width",
  				get: function get$$1() {

  						return this.renderTargetX.width;
  				}
  		}, {
  				key: "height",
  				get: function get$$1() {

  						return this.renderTargetX.height;
  				}
  		}, {
  				key: "kernelSize",
  				get: function get$$1() {

  						return this.convolutionMaterial.kernelSize;
  				},
  				set: function set$$1() {
  						var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : KernelSize.LARGE;


  						this.convolutionMaterial.kernelSize = value;
  				}
  		}]);
  		return BlurPass;
  }(Pass);

  var BloomPass = function (_Pass) {
  	inherits(BloomPass, _Pass);

  	function BloomPass() {
  		var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  		classCallCheck(this, BloomPass);

  		var _this = possibleConstructorReturn(this, (BloomPass.__proto__ || Object.getPrototypeOf(BloomPass)).call(this));

  		_this.name = "BloomPass";

  		_this.needsSwap = true;

  		_this.blurPass = new BlurPass(options);

  		_this.renderTarget = new three.WebGLRenderTarget(1, 1, {
  			minFilter: three.LinearFilter,
  			magFilter: three.LinearFilter,
  			stencilBuffer: false,
  			depthBuffer: false
  		});

  		_this.renderTarget.texture.name = "Bloom.Target";
  		_this.renderTarget.texture.generateMipmaps = false;

  		_this.combineMaterial = new CombineMaterial(options.screenMode !== undefined ? options.screenMode : true);

  		_this.intensity = options.intensity;

  		_this.luminosityMaterial = new LuminosityMaterial(true);

  		_this.distinction = options.distinction;

  		return _this;
  	}

  	createClass(BloomPass, [{
  		key: "render",
  		value: function render(renderer, readBuffer, writeBuffer) {

  			var quad = this.quad;
  			var scene = this.scene;
  			var camera = this.camera;
  			var blurPass = this.blurPass;

  			var luminosityMaterial = this.luminosityMaterial;
  			var combineMaterial = this.combineMaterial;
  			var renderTarget = this.renderTarget;

  			quad.material = luminosityMaterial;
  			luminosityMaterial.uniforms.tDiffuse.value = readBuffer.texture;
  			renderer.render(scene, camera, renderTarget);

  			blurPass.render(renderer, renderTarget, renderTarget);

  			quad.material = combineMaterial;
  			combineMaterial.uniforms.texture1.value = readBuffer.texture;
  			combineMaterial.uniforms.texture2.value = renderTarget.texture;

  			renderer.render(scene, camera, this.renderToScreen ? null : writeBuffer);
  		}
  	}, {
  		key: "initialise",
  		value: function initialise(renderer, alpha) {

  			this.blurPass.initialise(renderer, alpha);

  			if (!alpha) {

  				this.renderTarget.texture.format = three.RGBFormat;
  			}
  		}
  	}, {
  		key: "setSize",
  		value: function setSize(width, height) {

  			this.blurPass.setSize(width, height);

  			width = this.blurPass.width;
  			height = this.blurPass.height;

  			this.renderTarget.setSize(width, height);
  		}
  	}, {
  		key: "resolutionScale",
  		get: function get$$1() {

  			return this.blurPass.resolutionScale;
  		},
  		set: function set$$1() {
  			var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.5;


  			this.blurPass.resolutionScale = value;
  		}
  	}, {
  		key: "kernelSize",
  		get: function get$$1() {

  			return this.blurPass.kernelSize;
  		},
  		set: function set$$1() {
  			var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : KernelSize.LARGE;


  			this.blurPass.kernelSize = value;
  		}
  	}, {
  		key: "intensity",
  		get: function get$$1() {

  			return this.combineMaterial.uniforms.opacity2.value;
  		},
  		set: function set$$1() {
  			var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1.0;


  			this.combineMaterial.uniforms.opacity2.value = value;
  		}
  	}, {
  		key: "distinction",
  		get: function get$$1() {

  			return this.luminosityMaterial.uniforms.distinction.value;
  		},
  		set: function set$$1() {
  			var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1.0;


  			this.luminosityMaterial.uniforms.distinction.value = value;
  		}
  	}]);
  	return BloomPass;
  }(Pass);

  var BokehPass = function (_Pass) {
  		inherits(BokehPass, _Pass);

  		function BokehPass(camera) {
  				var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  				classCallCheck(this, BokehPass);

  				var _this = possibleConstructorReturn(this, (BokehPass.__proto__ || Object.getPrototypeOf(BokehPass)).call(this));

  				_this.name = "BokehPass";

  				_this.needsSwap = true;

  				_this.bokehMaterial = new BokehMaterial(camera, options);

  				_this.quad.material = _this.bokehMaterial;

  				return _this;
  		}

  		createClass(BokehPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer) {

  						this.bokehMaterial.uniforms.tDiffuse.value = readBuffer.texture;
  						this.bokehMaterial.uniforms.tDepth.value = readBuffer.depthTexture;

  						renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						this.bokehMaterial.uniforms.aspect.value = width / height;
  				}
  		}]);
  		return BokehPass;
  }(Pass);

  var Bokeh2Pass = function (_Pass) {
  		inherits(Bokeh2Pass, _Pass);

  		function Bokeh2Pass(camera) {
  				var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  				classCallCheck(this, Bokeh2Pass);

  				var _this = possibleConstructorReturn(this, (Bokeh2Pass.__proto__ || Object.getPrototypeOf(Bokeh2Pass)).call(this));

  				_this.name = "Bokeh2Pass";

  				_this.needsSwap = true;

  				_this.bokehMaterial = new Bokeh2Material(camera, options);

  				_this.quad.material = _this.bokehMaterial;

  				return _this;
  		}

  		createClass(Bokeh2Pass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer) {

  						this.bokehMaterial.uniforms.tDiffuse.value = readBuffer.texture;
  						this.bokehMaterial.uniforms.tDepth.value = readBuffer.depthTexture;

  						renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						this.bokehMaterial.setTexelSize(1.0 / width, 1.0 / height);
  				}
  		}]);
  		return Bokeh2Pass;
  }(Pass);

  var ClearMaskPass = function (_Pass) {
  	inherits(ClearMaskPass, _Pass);

  	function ClearMaskPass() {
  		classCallCheck(this, ClearMaskPass);

  		var _this = possibleConstructorReturn(this, (ClearMaskPass.__proto__ || Object.getPrototypeOf(ClearMaskPass)).call(this, null, null, null));

  		_this.name = "ClearMaskPass";

  		return _this;
  	}

  	createClass(ClearMaskPass, [{
  		key: "render",
  		value: function render(renderer) {

  			renderer.state.buffers.stencil.setTest(false);
  		}
  	}]);
  	return ClearMaskPass;
  }(Pass);

  var color = new three.Color();

  var ClearPass = function (_Pass) {
  		inherits(ClearPass, _Pass);

  		function ClearPass() {
  				var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  				classCallCheck(this, ClearPass);

  				var _this = possibleConstructorReturn(this, (ClearPass.__proto__ || Object.getPrototypeOf(ClearPass)).call(this, null, null, null));

  				_this.name = "ClearPass";

  				_this.clearColor = options.clearColor !== undefined ? options.clearColor : null;

  				_this.clearAlpha = options.clearAlpha !== undefined ? options.clearAlpha : 0.0;

  				return _this;
  		}

  		createClass(ClearPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer) {

  						var clearColor = this.clearColor;

  						var clearAlpha = void 0;

  						if (clearColor !== null) {

  								color.copy(renderer.getClearColor());
  								clearAlpha = renderer.getClearAlpha();
  								renderer.setClearColor(clearColor, this.clearAlpha);
  						}

  						renderer.setRenderTarget(this.renderToScreen ? null : readBuffer);
  						renderer.clear();

  						if (clearColor !== null) {

  								renderer.setClearColor(color, clearAlpha);
  						}
  				}
  		}]);
  		return ClearPass;
  }(Pass);

  var DotScreenPass = function (_Pass) {
  		inherits(DotScreenPass, _Pass);

  		function DotScreenPass() {
  				var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  				classCallCheck(this, DotScreenPass);

  				var _this = possibleConstructorReturn(this, (DotScreenPass.__proto__ || Object.getPrototypeOf(DotScreenPass)).call(this));

  				_this.name = "DotScreenPass";

  				_this.needsSwap = true;

  				_this.material = new DotScreenMaterial(options);

  				_this.quad.material = _this.material;

  				return _this;
  		}

  		createClass(DotScreenPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer) {

  						this.material.uniforms.tDiffuse.value = readBuffer.texture;

  						renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						width = Math.max(1, width);
  						height = Math.max(1, height);

  						this.material.uniforms.offsetRepeat.value.z = width;
  						this.material.uniforms.offsetRepeat.value.w = height;
  				}
  		}]);
  		return DotScreenPass;
  }(Pass);

  var FilmPass = function (_Pass) {
  		inherits(FilmPass, _Pass);

  		function FilmPass() {
  				var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  				classCallCheck(this, FilmPass);

  				var _this = possibleConstructorReturn(this, (FilmPass.__proto__ || Object.getPrototypeOf(FilmPass)).call(this));

  				_this.name = "FilmPass";

  				_this.needsSwap = true;

  				_this.material = new FilmMaterial(options);

  				_this.quad.material = _this.material;

  				_this.scanlineDensity = options.scanlineDensity === undefined ? 1.25 : options.scanlineDensity;

  				return _this;
  		}

  		createClass(FilmPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer, delta) {

  						this.material.uniforms.tDiffuse.value = readBuffer.texture;
  						this.material.uniforms.time.value += delta;

  						renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						this.material.uniforms.scanlineCount.value = Math.round(height * this.scanlineDensity);
  				}
  		}]);
  		return FilmPass;
  }(Pass);

  function randomInt(low, high) {

  		return low + Math.floor(Math.random() * (high - low + 1));
  }

  function randomFloat(low, high) {

  		return low + Math.random() * (high - low);
  }

  var GlitchPass = function (_Pass) {
  		inherits(GlitchPass, _Pass);

  		function GlitchPass() {
  				var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  				classCallCheck(this, GlitchPass);

  				var _this = possibleConstructorReturn(this, (GlitchPass.__proto__ || Object.getPrototypeOf(GlitchPass)).call(this));

  				_this.name = "GlitchPass";

  				_this.needsSwap = true;

  				_this.material = new GlitchMaterial();

  				_this.quad.material = _this.material;

  				_this.texture = null;

  				_this.perturbMap = options.perturbMap !== undefined ? options.perturbMap : _this.generatePerturbMap(options.dtSize);
  				_this.perturbMap.name = "Glitch.Perturbation";
  				_this.perturbMap.generateMipmaps = false;

  				_this.mode = GlitchMode.SPORADIC;

  				_this.counter = 0;

  				_this.breakPoint = randomInt(120, 240);

  				return _this;
  		}

  		createClass(GlitchPass, [{
  				key: "generatePerturbMap",
  				value: function generatePerturbMap() {
  						var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 64;


  						var pixels = size * size;
  						var data = new Float32Array(pixels * 3);

  						var dt = this.perturbMap;
  						var i = void 0,
  						    x = void 0;

  						for (i = 0; i < pixels; ++i) {

  								x = Math.random();

  								data[i * 3] = x;
  								data[i * 3 + 1] = x;
  								data[i * 3 + 2] = x;
  						}

  						if (dt !== null) {

  								dt.dispose();
  						}

  						dt = new three.DataTexture(data, size, size, three.RGBFormat, three.FloatType);
  						dt.needsUpdate = true;

  						this.perturbMap = dt;

  						return dt;
  				}
  		}, {
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer) {

  						var mode = this.mode;
  						var counter = this.counter;
  						var breakPoint = this.breakPoint;
  						var uniforms = this.material.uniforms;

  						uniforms.tDiffuse.value = readBuffer.texture;
  						uniforms.seed.value = Math.random();
  						uniforms.active.value = true;

  						if (counter % breakPoint === 0 || mode === GlitchMode.CONSTANT_WILD) {

  								uniforms.amount.value = Math.random() / 30.0;
  								uniforms.angle.value = randomFloat(-Math.PI, Math.PI);
  								uniforms.seedX.value = randomFloat(-1.0, 1.0);
  								uniforms.seedY.value = randomFloat(-1.0, 1.0);
  								uniforms.distortionX.value = randomFloat(0.0, 1.0);
  								uniforms.distortionY.value = randomFloat(0.0, 1.0);

  								this.breakPoint = randomInt(120, 240);
  								this.counter = 0;
  						} else {

  								if (counter % breakPoint < breakPoint / 5 || mode === GlitchMode.CONSTANT_MILD) {

  										uniforms.amount.value = Math.random() / 90.0;
  										uniforms.angle.value = randomFloat(-Math.PI, Math.PI);
  										uniforms.distortionX.value = randomFloat(0.0, 1.0);
  										uniforms.distortionY.value = randomFloat(0.0, 1.0);
  										uniforms.seedX.value = randomFloat(-0.3, 0.3);
  										uniforms.seedY.value = randomFloat(-0.3, 0.3);
  								} else {
  										uniforms.active.value = false;
  								}
  						}

  						++this.counter;

  						renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "perturbMap",
  				get: function get$$1() {

  						return this.texture;
  				},
  				set: function set$$1(value) {

  						this.texture = value;
  						this.material.uniforms.tPerturb.value = value;
  				}
  		}]);
  		return GlitchPass;
  }(Pass);

  var GlitchMode = {

  		SPORADIC: 0,
  		CONSTANT_MILD: 1,
  		CONSTANT_WILD: 2

  };

  var RenderPass = function (_Pass) {
  		inherits(RenderPass, _Pass);

  		function RenderPass(scene, camera) {
  				var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  				classCallCheck(this, RenderPass);

  				var _this = possibleConstructorReturn(this, (RenderPass.__proto__ || Object.getPrototypeOf(RenderPass)).call(this, scene, camera, null));

  				_this.name = "RenderPass";

  				_this.clearPass = new ClearPass(options);

  				_this.overrideMaterial = options.overrideMaterial !== undefined ? options.overrideMaterial : null;

  				_this.clearDepth = options.clearDepth !== undefined ? options.clearDepth : false;

  				_this.clear = options.clear !== undefined ? options.clear : true;

  				return _this;
  		}

  		createClass(RenderPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer) {

  						var scene = this.scene;
  						var target = this.renderToScreen ? null : readBuffer;

  						if (this.clear) {

  								this.clearPass.render(renderer, target);
  						} else if (this.clearDepth) {

  								renderer.setRenderTarget(target);
  								renderer.clearDepth();
  						}

  						scene.overrideMaterial = this.overrideMaterial;
  						renderer.render(scene, this.camera, target);
  						scene.overrideMaterial = null;
  				}
  		}]);
  		return RenderPass;
  }(Pass);

  function clamp(value, min, max) {

  		return Math.max(min, Math.min(max, value));
  }

  var GodRaysPass = function (_Pass) {
  		inherits(GodRaysPass, _Pass);

  		function GodRaysPass(scene, camera, lightSource) {
  				var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  				classCallCheck(this, GodRaysPass);

  				var _this = possibleConstructorReturn(this, (GodRaysPass.__proto__ || Object.getPrototypeOf(GodRaysPass)).call(this));

  				_this.name = "GodRaysPass";

  				_this.needsSwap = true;

  				_this.lightScene = new three.Scene();

  				_this.mainScene = scene;

  				_this.mainCamera = camera;

  				_this.renderPassLight = new RenderPass(_this.lightScene, _this.mainCamera);

  				_this.renderPassMask = new RenderPass(_this.mainScene, _this.mainCamera, {
  						overrideMaterial: new three.MeshBasicMaterial({ color: 0x000000 }),
  						clearColor: new three.Color(0x000000)
  				});

  				_this.renderPassMask.clear = false;

  				_this.blurPass = new BlurPass(options);

  				_this.renderTargetX = new three.WebGLRenderTarget(1, 1, {
  						minFilter: three.LinearFilter,
  						magFilter: three.LinearFilter,
  						stencilBuffer: false,
  						depthBuffer: false
  				});

  				_this.renderTargetX.texture.name = "GodRays.TargetX";
  				_this.renderTargetX.texture.generateMipmaps = false;

  				_this.renderTargetY = _this.renderTargetX.clone();

  				_this.renderTargetY.texture.name = "GodRays.TargetY";

  				_this.renderTargetMask = new three.WebGLRenderTarget(1, 1, {
  						minFilter: three.LinearFilter,
  						magFilter: three.LinearFilter
  				});

  				_this.renderTargetMask.texture.name = "GodRays.Mask";
  				_this.renderTargetMask.texture.generateMipmaps = false;

  				_this.lightSource = lightSource;

  				_this.screenPosition = new three.Vector3();

  				_this.godRaysMaterial = new GodRaysMaterial(options);
  				_this.godRaysMaterial.uniforms.lightPosition.value = _this.screenPosition;

  				_this.samples = options.samples;

  				_this.combineMaterial = new CombineMaterial(options.screenMode !== undefined ? options.screenMode : true);

  				_this.intensity = options.intensity;

  				return _this;
  		}

  		createClass(GodRaysPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer) {

  						var quad = this.quad;
  						var scene = this.scene;
  						var camera = this.camera;
  						var mainScene = this.mainScene;

  						var lightSource = this.lightSource;
  						var screenPosition = this.screenPosition;

  						var godRaysMaterial = this.godRaysMaterial;
  						var combineMaterial = this.combineMaterial;

  						var renderTargetMask = this.renderTargetMask;
  						var renderTargetX = this.renderTargetX;
  						var renderTargetY = this.renderTargetY;

  						var background = void 0,
  						    parent = void 0;

  						screenPosition.copy(lightSource.position).project(this.mainCamera);
  						screenPosition.x = clamp((screenPosition.x + 1.0) * 0.5, 0.0, 1.0);
  						screenPosition.y = clamp((screenPosition.y + 1.0) * 0.5, 0.0, 1.0);

  						parent = lightSource.parent;
  						background = mainScene.background;
  						mainScene.background = null;
  						this.lightScene.add(lightSource);

  						this.renderPassLight.render(renderer, renderTargetMask);
  						this.renderPassMask.render(renderer, renderTargetMask);

  						if (parent !== null) {

  								parent.add(lightSource);
  						}

  						mainScene.background = background;

  						this.blurPass.render(renderer, renderTargetMask, renderTargetX);

  						quad.material = godRaysMaterial;
  						godRaysMaterial.uniforms.tDiffuse.value = renderTargetX.texture;
  						renderer.render(scene, camera, renderTargetY);

  						quad.material = combineMaterial;
  						combineMaterial.uniforms.texture1.value = readBuffer.texture;
  						combineMaterial.uniforms.texture2.value = renderTargetY.texture;

  						renderer.render(scene, camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "initialise",
  				value: function initialise(renderer, alpha) {

  						this.renderPassLight.initialise(renderer, alpha);
  						this.renderPassMask.initialise(renderer, alpha);
  						this.blurPass.initialise(renderer, alpha);

  						if (!alpha) {

  								this.renderTargetMask.texture.format = three.RGBFormat;
  								this.renderTargetX.texture.format = three.RGBFormat;
  								this.renderTargetY.texture.format = three.RGBFormat;
  						}
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						this.renderPassLight.setSize(width, height);
  						this.renderPassMask.setSize(width, height);
  						this.blurPass.setSize(width, height);

  						width = this.blurPass.width;
  						height = this.blurPass.height;

  						this.renderTargetMask.setSize(width, height);
  						this.renderTargetX.setSize(width, height);
  						this.renderTargetY.setSize(width, height);
  				}
  		}, {
  				key: "resolutionScale",
  				get: function get$$1() {

  						return this.blurPass.resolutionScale;
  				},
  				set: function set$$1() {
  						var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.5;


  						this.blurPass.resolutionScale = value;
  				}
  		}, {
  				key: "kernelSize",
  				get: function get$$1() {

  						return this.blurPass.kernelSize;
  				},
  				set: function set$$1() {
  						var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : KernelSize.LARGE;


  						this.blurPass.kernelSize = value;
  				}
  		}, {
  				key: "intensity",
  				get: function get$$1() {

  						return this.combineMaterial.uniforms.opacity2.value;
  				},
  				set: function set$$1() {
  						var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1.0;


  						this.combineMaterial.uniforms.opacity2.value = value;
  				}
  		}, {
  				key: "samples",
  				get: function get$$1() {

  						return Number.parseInt(this.godRaysMaterial.defines.NUM_SAMPLES_INT);
  				},
  				set: function set$$1() {
  						var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 60;


  						value = Math.floor(value);

  						this.godRaysMaterial.defines.NUM_SAMPLES_FLOAT = value.toFixed(1);
  						this.godRaysMaterial.defines.NUM_SAMPLES_INT = value.toFixed(0);
  						this.godRaysMaterial.needsUpdate = true;
  				}
  		}]);
  		return GodRaysPass;
  }(Pass);

  var MaskPass = function (_Pass) {
  		inherits(MaskPass, _Pass);

  		function MaskPass(scene, camera) {
  				classCallCheck(this, MaskPass);

  				var _this = possibleConstructorReturn(this, (MaskPass.__proto__ || Object.getPrototypeOf(MaskPass)).call(this, scene, camera, null));

  				_this.name = "MaskPass";

  				_this.inverse = false;

  				_this.clearStencil = true;

  				return _this;
  		}

  		createClass(MaskPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer) {

  						var context = renderer.context;
  						var state = renderer.state;

  						var scene = this.scene;
  						var camera = this.camera;

  						var writeValue = this.inverse ? 0 : 1;
  						var clearValue = 1 - writeValue;

  						state.buffers.color.setMask(false);
  						state.buffers.depth.setMask(false);

  						state.buffers.color.setLocked(true);
  						state.buffers.depth.setLocked(true);

  						state.buffers.stencil.setTest(true);
  						state.buffers.stencil.setOp(context.REPLACE, context.REPLACE, context.REPLACE);
  						state.buffers.stencil.setFunc(context.ALWAYS, writeValue, 0xffffffff);
  						state.buffers.stencil.setClear(clearValue);

  						if (this.clearStencil) {

  								renderer.setRenderTarget(readBuffer);
  								renderer.clearStencil();

  								renderer.setRenderTarget(writeBuffer);
  								renderer.clearStencil();
  						}

  						renderer.render(scene, camera, readBuffer);
  						renderer.render(scene, camera, writeBuffer);

  						state.buffers.color.setLocked(false);
  						state.buffers.depth.setLocked(false);

  						state.buffers.stencil.setFunc(context.EQUAL, 1, 0xffffffff);
  						state.buffers.stencil.setOp(context.KEEP, context.KEEP, context.KEEP);
  				}
  		}]);
  		return MaskPass;
  }(Pass);

  var PixelationPass = function (_Pass) {
  		inherits(PixelationPass, _Pass);

  		function PixelationPass() {
  				var granularity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 30.0;
  				classCallCheck(this, PixelationPass);

  				var _this = possibleConstructorReturn(this, (PixelationPass.__proto__ || Object.getPrototypeOf(PixelationPass)).call(this));

  				_this.name = "PixelationPass";

  				_this.needsSwap = true;

  				_this.pixelationMaterial = new PixelationMaterial();

  				_this.granularity = granularity;

  				_this.quad.material = _this.pixelationMaterial;

  				return _this;
  		}

  		createClass(PixelationPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer) {

  						this.pixelationMaterial.uniforms.tDiffuse.value = readBuffer.texture;

  						renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						this.pixelationMaterial.setResolution(width, height);
  				}
  		}, {
  				key: "granularity",
  				get: function get$$1() {

  						return this.pixelationMaterial.granularity;
  				},
  				set: function set$$1() {
  						var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 30;


  						value = Math.floor(value);

  						if (value % 2 > 0) {

  								value += 1;
  						}

  						this.pixelationMaterial.granularity = value;
  				}
  		}]);
  		return PixelationPass;
  }(Pass);

  var SavePass = function (_Pass) {
  		inherits(SavePass, _Pass);

  		function SavePass(renderTarget) {
  				var resize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  				classCallCheck(this, SavePass);

  				var _this = possibleConstructorReturn(this, (SavePass.__proto__ || Object.getPrototypeOf(SavePass)).call(this));

  				_this.name = "SavePass";

  				_this.material = new CopyMaterial();

  				_this.quad.material = _this.material;

  				_this.renderTarget = renderTarget !== undefined ? renderTarget : new three.WebGLRenderTarget(1, 1, {
  						minFilter: three.LinearFilter,
  						magFilter: three.LinearFilter,
  						stencilBuffer: false,
  						depthBuffer: false
  				});

  				_this.renderTarget.texture.name = "Save.Target";
  				_this.renderTarget.texture.generateMipmaps = false;

  				_this.resize = resize;

  				return _this;
  		}

  		createClass(SavePass, [{
  				key: "render",
  				value: function render(renderer, readBuffer) {

  						this.material.uniforms.tDiffuse.value = readBuffer.texture;

  						renderer.render(this.scene, this.camera, this.renderTarget);
  				}
  		}, {
  				key: "initialise",
  				value: function initialise(renderer, alpha) {

  						if (!alpha) {

  								this.renderTarget.texture.format = three.RGBFormat;
  						}
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						if (this.resize) {

  								width = Math.max(1, width);
  								height = Math.max(1, height);

  								this.renderTarget.setSize(width, height);
  						}
  				}
  		}]);
  		return SavePass;
  }(Pass);

  var ShaderPass = function (_Pass) {
  		inherits(ShaderPass, _Pass);

  		function ShaderPass(material) {
  				var textureID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "tDiffuse";
  				classCallCheck(this, ShaderPass);

  				var _this = possibleConstructorReturn(this, (ShaderPass.__proto__ || Object.getPrototypeOf(ShaderPass)).call(this));

  				_this.name = "ShaderPass";

  				_this.needsSwap = true;

  				_this.material = material;

  				_this.quad.material = _this.material;

  				_this.textureID = textureID;

  				return _this;
  		}

  		createClass(ShaderPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer) {

  						if (this.material.uniforms[this.textureID] !== undefined) {

  								this.material.uniforms[this.textureID].value = readBuffer.texture;
  						}

  						renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}]);
  		return ShaderPass;
  }(Pass);

  var HALF_PI = Math.PI * 0.5;

  var v = new three.Vector3();

  var ab = new three.Vector3();

  var ShockWavePass = function (_Pass) {
  		inherits(ShockWavePass, _Pass);

  		function ShockWavePass(camera) {
  				var epicenter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new three.Vector3();
  				var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  				classCallCheck(this, ShockWavePass);

  				var _this = possibleConstructorReturn(this, (ShockWavePass.__proto__ || Object.getPrototypeOf(ShockWavePass)).call(this));

  				_this.name = "ShockWavePass";

  				_this.needsSwap = true;

  				_this.mainCamera = camera;

  				_this.epicenter = epicenter;

  				_this.screenPosition = new three.Vector3();

  				_this.speed = options.speed !== undefined ? options.speed : 2.0;

  				_this.time = 0.0;

  				_this.active = false;

  				_this.shockWaveMaterial = new ShockWaveMaterial(options);

  				_this.shockWaveMaterial.uniforms.center.value = _this.screenPosition;

  				_this.copyMaterial = new CopyMaterial();

  				return _this;
  		}

  		createClass(ShockWavePass, [{
  				key: "explode",
  				value: function explode() {

  						this.time = 0.0;
  						this.active = true;
  				}
  		}, {
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer, delta) {

  						var epicenter = this.epicenter;
  						var mainCamera = this.mainCamera;
  						var screenPosition = this.screenPosition;

  						var shockWaveMaterial = this.shockWaveMaterial;
  						var uniforms = shockWaveMaterial.uniforms;
  						var center = uniforms.center;
  						var radius = uniforms.radius;
  						var maxRadius = uniforms.maxRadius;
  						var waveSize = uniforms.waveSize;

  						this.copyMaterial.uniforms.tDiffuse.value = readBuffer.texture;
  						this.quad.material = this.copyMaterial;

  						if (this.active) {
  								mainCamera.getWorldDirection(v);
  								ab.copy(mainCamera.position).sub(epicenter);

  								if (v.angleTo(ab) > HALF_PI) {
  										uniforms.cameraDistance.value = mainCamera.position.distanceTo(epicenter);

  										screenPosition.copy(epicenter).project(mainCamera);
  										center.value.x = (screenPosition.x + 1.0) * 0.5;
  										center.value.y = (screenPosition.y + 1.0) * 0.5;

  										uniforms.tDiffuse.value = readBuffer.texture;
  										this.quad.material = shockWaveMaterial;
  								}

  								this.time += delta * this.speed;
  								radius.value = this.time - waveSize.value;

  								if (radius.value >= (maxRadius.value + waveSize.value) * 2) {

  										this.active = false;
  								}
  						}

  						renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						this.shockWaveMaterial.uniforms.aspect.value = width / height;
  				}
  		}]);
  		return ShockWavePass;
  }(Pass);

  var searchImageDataUrl = "";

  var areaImageDataUrl = "";

  var SMAAPass = function (_Pass) {
  		inherits(SMAAPass, _Pass);

  		function SMAAPass(searchImage, areaImage) {
  				classCallCheck(this, SMAAPass);

  				var _this = possibleConstructorReturn(this, (SMAAPass.__proto__ || Object.getPrototypeOf(SMAAPass)).call(this));

  				_this.name = "SMAAPass";

  				_this.needsSwap = true;

  				_this.renderTargetColorEdges = new three.WebGLRenderTarget(1, 1, {
  						minFilter: three.LinearFilter,
  						format: three.RGBFormat,
  						stencilBuffer: false,
  						depthBuffer: false
  				});

  				_this.renderTargetColorEdges.texture.name = "SMAA.ColorEdges";
  				_this.renderTargetColorEdges.texture.generateMipmaps = false;

  				_this.renderTargetWeights = _this.renderTargetColorEdges.clone();

  				_this.renderTargetWeights.texture.name = "SMAA.Weights";
  				_this.renderTargetWeights.texture.format = three.RGBAFormat;

  				_this.colorEdgesMaterial = new SMAAColorEdgesMaterial();

  				_this.weightsMaterial = new SMAAWeightsMaterial();

  				_this.weightsMaterial.uniforms.tDiffuse.value = _this.renderTargetColorEdges.texture;

  				_this.searchTexture = new three.Texture(searchImage);

  				_this.searchTexture.name = "SMAA.Search";
  				_this.searchTexture.magFilter = three.NearestFilter;
  				_this.searchTexture.minFilter = three.NearestFilter;
  				_this.searchTexture.format = three.RGBAFormat;
  				_this.searchTexture.generateMipmaps = false;
  				_this.searchTexture.needsUpdate = true;
  				_this.searchTexture.flipY = false;

  				_this.weightsMaterial.uniforms.tSearch.value = _this.searchTexture;

  				_this.areaTexture = new three.Texture(areaImage);

  				_this.areaTexture.name = "SMAA.Area";
  				_this.areaTexture.minFilter = three.LinearFilter;
  				_this.areaTexture.format = three.RGBAFormat;
  				_this.areaTexture.generateMipmaps = false;
  				_this.areaTexture.needsUpdate = true;
  				_this.areaTexture.flipY = false;

  				_this.weightsMaterial.uniforms.tArea.value = _this.areaTexture;

  				_this.blendMaterial = new SMAABlendMaterial();

  				_this.blendMaterial.uniforms.tWeights.value = _this.renderTargetWeights.texture;

  				_this.quad.material = _this.blendMaterial;

  				return _this;
  		}

  		createClass(SMAAPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer) {
  						this.quad.material = this.colorEdgesMaterial;
  						this.colorEdgesMaterial.uniforms.tDiffuse.value = readBuffer.texture;
  						renderer.render(this.scene, this.camera, this.renderTargetColorEdges, true);

  						this.quad.material = this.weightsMaterial;
  						renderer.render(this.scene, this.camera, this.renderTargetWeights, false);

  						this.quad.material = this.blendMaterial;
  						this.blendMaterial.uniforms.tDiffuse.value = readBuffer.texture;

  						renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						this.renderTargetColorEdges.setSize(width, height);
  						this.renderTargetWeights.setSize(width, height);

  						this.colorEdgesMaterial.uniforms.texelSize.value.copy(this.weightsMaterial.uniforms.texelSize.value.copy(this.blendMaterial.uniforms.texelSize.value.set(1.0 / width, 1.0 / height)));
  				}
  		}], [{
  				key: "searchImageDataUrl",
  				get: function get$$1() {

  						return searchImageDataUrl;
  				}
  		}, {
  				key: "areaImageDataUrl",
  				get: function get$$1() {

  						return areaImageDataUrl;
  				}
  		}]);
  		return SMAAPass;
  }(Pass);

  var TexturePass = function (_Pass) {
  	inherits(TexturePass, _Pass);

  	function TexturePass(texture) {
  		var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1.0;
  		classCallCheck(this, TexturePass);

  		var _this = possibleConstructorReturn(this, (TexturePass.__proto__ || Object.getPrototypeOf(TexturePass)).call(this));

  		_this.name = "TexturePass";

  		_this.copyMaterial = new CopyMaterial();
  		_this.copyMaterial.blending = three.AdditiveBlending;
  		_this.copyMaterial.transparent = true;

  		_this.texture = texture;
  		_this.opacity = opacity;

  		_this.quad.material = _this.copyMaterial;

  		return _this;
  	}

  	createClass(TexturePass, [{
  		key: "render",
  		value: function render(renderer, readBuffer) {

  			renderer.render(this.scene, this.camera, this.renderToScreen ? null : readBuffer);
  		}
  	}, {
  		key: "texture",
  		get: function get$$1() {

  			return this.copyMaterial.uniforms.tDiffuse.value;
  		},
  		set: function set$$1(value) {

  			this.copyMaterial.uniforms.tDiffuse.value = value;
  		}
  	}, {
  		key: "opacity",
  		get: function get$$1() {

  			return this.copyMaterial.uniforms.opacity.value;
  		},
  		set: function set$$1() {
  			var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1.0;


  			this.copyMaterial.uniforms.opacity.value = value;
  		}
  	}]);
  	return TexturePass;
  }(Pass);

  function ceil2(n) {

  		return Math.pow(2, Math.max(0, Math.ceil(Math.log2(n))));
  }

  var ToneMappingPass = function (_Pass) {
  		inherits(ToneMappingPass, _Pass);

  		function ToneMappingPass() {
  				var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  				classCallCheck(this, ToneMappingPass);

  				var _this = possibleConstructorReturn(this, (ToneMappingPass.__proto__ || Object.getPrototypeOf(ToneMappingPass)).call(this));

  				_this.name = "ToneMappingPass";

  				_this.needsSwap = true;

  				_this.renderTargetLuminosity = new three.WebGLRenderTarget(1, 1, {
  						minFilter: three.LinearMipMapLinearFilter,
  						magFilter: three.LinearFilter,
  						format: three.RGBFormat,
  						stencilBuffer: false,
  						depthBuffer: false
  				});

  				_this.renderTargetLuminosity.texture.name = "ToneMapping.Luminosity";

  				_this.renderTargetAdapted = _this.renderTargetLuminosity.clone();

  				_this.renderTargetAdapted.texture.name = "ToneMapping.AdaptedLuminosity";
  				_this.renderTargetAdapted.texture.generateMipmaps = false;
  				_this.renderTargetAdapted.texture.minFilter = three.LinearFilter;

  				_this.renderTargetPrevious = _this.renderTargetAdapted.clone();

  				_this.renderTargetPrevious.texture.name = "ToneMapping.PreviousLuminosity";

  				_this.copyMaterial = new CopyMaterial();

  				_this.luminosityMaterial = new LuminosityMaterial();

  				_this.luminosityMaterial.uniforms.distinction.value = options.distinction !== undefined ? options.distinction : 1.0;

  				_this.adaptiveLuminosityMaterial = new AdaptiveLuminosityMaterial();

  				_this.resolution = options.resolution;

  				_this.toneMappingMaterial = new ToneMappingMaterial();

  				_this.adaptive = options.adaptive;

  				return _this;
  		}

  		createClass(ToneMappingPass, [{
  				key: "render",
  				value: function render(renderer, readBuffer, writeBuffer, delta) {

  						var quad = this.quad;
  						var scene = this.scene;
  						var camera = this.camera;

  						var adaptiveLuminosityMaterial = this.adaptiveLuminosityMaterial;
  						var luminosityMaterial = this.luminosityMaterial;
  						var toneMappingMaterial = this.toneMappingMaterial;
  						var copyMaterial = this.copyMaterial;

  						var renderTargetPrevious = this.renderTargetPrevious;
  						var renderTargetLuminosity = this.renderTargetLuminosity;
  						var renderTargetAdapted = this.renderTargetAdapted;

  						if (this.adaptive) {
  								quad.material = luminosityMaterial;
  								luminosityMaterial.uniforms.tDiffuse.value = readBuffer.texture;
  								renderer.render(scene, camera, renderTargetLuminosity);

  								quad.material = adaptiveLuminosityMaterial;
  								adaptiveLuminosityMaterial.uniforms.delta.value = delta;
  								adaptiveLuminosityMaterial.uniforms.tPreviousLum.value = renderTargetPrevious.texture;
  								adaptiveLuminosityMaterial.uniforms.tCurrentLum.value = renderTargetLuminosity.texture;
  								renderer.render(scene, camera, renderTargetAdapted);

  								quad.material = copyMaterial;
  								copyMaterial.uniforms.tDiffuse.value = renderTargetAdapted.texture;
  								renderer.render(scene, camera, renderTargetPrevious);
  						}

  						quad.material = toneMappingMaterial;
  						toneMappingMaterial.uniforms.tDiffuse.value = readBuffer.texture;

  						renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);
  				}
  		}, {
  				key: "initialise",
  				value: function initialise(renderer) {

  						this.quad.material = new three.MeshBasicMaterial({ color: 0x7fffff });
  						renderer.render(this.scene, this.camera, this.renderTargetPrevious);
  						this.quad.material.dispose();
  				}
  		}, {
  				key: "resolution",
  				get: function get$$1() {

  						return this.renderTargetLuminosity.width;
  				},
  				set: function set$$1() {
  						var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 256;


  						value = ceil2(value);

  						this.renderTargetLuminosity.setSize(value, value);
  						this.renderTargetPrevious.setSize(value, value);
  						this.renderTargetAdapted.setSize(value, value);

  						this.adaptiveLuminosityMaterial.defines.MIP_LEVEL_1X1 = (Math.round(Math.log(value)) / Math.log(2)).toFixed(1);
  						this.adaptiveLuminosityMaterial.needsUpdate = true;
  				}
  		}, {
  				key: "adaptive",
  				get: function get$$1() {

  						return this.toneMappingMaterial.defines.ADAPTED_LUMINANCE !== undefined;
  				},
  				set: function set$$1() {
  						var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;


  						if (value) {

  								this.toneMappingMaterial.defines.ADAPTED_LUMINANCE = "1";
  								this.toneMappingMaterial.uniforms.luminanceMap.value = this.renderTargetAdapted.texture;
  						} else {

  								delete this.toneMappingMaterial.defines.ADAPTED_LUMINANCE;
  								this.toneMappingMaterial.uniforms.luminanceMap.value = null;
  						}

  						this.toneMappingMaterial.needsUpdate = true;
  				}
  		}]);
  		return ToneMappingPass;
  }(Pass);

  var EffectComposer = function () {
  		function EffectComposer() {
  				var renderer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  				var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  				classCallCheck(this, EffectComposer);


  				this.renderer = renderer;

  				this.readBuffer = null;

  				this.writeBuffer = null;

  				if (this.renderer !== null) {

  						this.renderer.autoClear = false;

  						this.readBuffer = this.createBuffer(options.depthBuffer !== undefined ? options.depthBuffer : true, options.stencilBuffer !== undefined ? options.stencilBuffer : false, options.depthTexture !== undefined ? options.depthTexture : false);

  						this.writeBuffer = this.readBuffer.clone();
  				}

  				this.copyPass = new ShaderPass(new CopyMaterial());

  				this.passes = [];
  		}

  		createClass(EffectComposer, [{
  				key: "replaceRenderer",
  				value: function replaceRenderer(renderer) {

  						var oldRenderer = this.renderer;

  						var parent = void 0,
  						    oldSize = void 0,
  						    newSize = void 0;

  						if (oldRenderer !== null && oldRenderer !== renderer) {

  								this.renderer = renderer;
  								this.renderer.autoClear = false;

  								parent = oldRenderer.domElement.parentNode;
  								oldSize = oldRenderer.getSize();
  								newSize = renderer.getSize();

  								if (parent !== null) {

  										parent.removeChild(oldRenderer.domElement);
  										parent.appendChild(renderer.domElement);
  								}

  								if (oldSize.width !== newSize.width || oldSize.height !== newSize.height) {

  										this.setSize();
  								}
  						}

  						return oldRenderer;
  				}
  		}, {
  				key: "createBuffer",
  				value: function createBuffer(depthBuffer, stencilBuffer, depthTexture) {

  						var drawingBufferSize = this.renderer.getDrawingBufferSize();
  						var alpha = this.renderer.context.getContextAttributes().alpha;

  						var renderTarget = new three.WebGLRenderTarget(drawingBufferSize.width, drawingBufferSize.height, {
  								minFilter: three.LinearFilter,
  								magFilter: three.LinearFilter,
  								format: alpha ? three.RGBAFormat : three.RGBFormat,
  								depthBuffer: depthBuffer,
  								stencilBuffer: stencilBuffer,
  								depthTexture: depthTexture ? new three.DepthTexture() : null
  						});

  						if (depthTexture && stencilBuffer) {

  								renderTarget.depthTexture.format = three.DepthStencilFormat;
  								renderTarget.depthTexture.type = three.UnsignedInt248Type;
  						}

  						renderTarget.texture.name = "EffectComposer.Buffer";
  						renderTarget.texture.generateMipmaps = false;

  						return renderTarget;
  				}
  		}, {
  				key: "addPass",
  				value: function addPass(pass, index) {

  						var renderer = this.renderer;
  						var drawingBufferSize = renderer.getDrawingBufferSize();

  						pass.setSize(drawingBufferSize.width, drawingBufferSize.height);
  						pass.initialise(renderer, renderer.context.getContextAttributes().alpha);

  						if (index !== undefined) {

  								this.passes.splice(index, 0, pass);
  						} else {

  								this.passes.push(pass);
  						}
  				}
  		}, {
  				key: "removePass",
  				value: function removePass(pass) {

  						this.passes.splice(this.passes.indexOf(pass), 1);
  				}
  		}, {
  				key: "render",
  				value: function render(delta) {

  						var passes = this.passes;
  						var renderer = this.renderer;
  						var copyPass = this.copyPass;

  						var readBuffer = this.readBuffer;
  						var writeBuffer = this.writeBuffer;

  						var maskActive = false;
  						var pass = void 0,
  						    context = void 0,
  						    buffer = void 0;
  						var i = void 0,
  						    l = void 0;

  						for (i = 0, l = passes.length; i < l; ++i) {

  								pass = passes[i];

  								if (pass.enabled) {

  										pass.render(renderer, readBuffer, writeBuffer, delta, maskActive);

  										if (pass.needsSwap) {

  												if (maskActive) {

  														context = renderer.context;
  														context.stencilFunc(context.NOTEQUAL, 1, 0xffffffff);
  														copyPass.render(renderer, readBuffer, writeBuffer);
  														context.stencilFunc(context.EQUAL, 1, 0xffffffff);
  												}

  												buffer = readBuffer;
  												readBuffer = writeBuffer;
  												writeBuffer = buffer;
  										}

  										if (pass instanceof MaskPass) {

  												maskActive = true;
  										} else if (pass instanceof ClearMaskPass) {

  												maskActive = false;
  										}
  								}
  						}
  				}
  		}, {
  				key: "setSize",
  				value: function setSize(width, height) {

  						var passes = this.passes;
  						var renderer = this.renderer;

  						var size = void 0,
  						    drawingBufferSize = void 0;
  						var i = void 0,
  						    l = void 0;

  						if (width === undefined || height === undefined) {

  								size = renderer.getSize();
  								width = size.width;
  								height = size.height;
  						}

  						renderer.setSize(width, height);

  						drawingBufferSize = renderer.getDrawingBufferSize();

  						this.readBuffer.setSize(drawingBufferSize.width, drawingBufferSize.height);
  						this.writeBuffer.setSize(drawingBufferSize.width, drawingBufferSize.height);

  						for (i = 0, l = passes.length; i < l; ++i) {

  								passes[i].setSize(drawingBufferSize.width, drawingBufferSize.height);
  						}
  				}
  		}, {
  				key: "reset",
  				value: function reset(renderTarget) {

  						var depthBuffer = this.readBuffer.depthBuffer;
  						var stencilBuffer = this.readBuffer.stencilBuffer;
  						var depthTexture = this.readBuffer.depthTexture !== null;

  						this.dispose(renderTarget === undefined ? this.createBuffer(depthBuffer, stencilBuffer, depthTexture) : renderTarget);
  				}
  		}, {
  				key: "dispose",
  				value: function dispose(renderTarget) {

  						var passes = this.passes;

  						if (this.readBuffer !== null && this.writeBuffer !== null) {

  								this.readBuffer.dispose();
  								this.writeBuffer.dispose();

  								this.readBuffer = null;
  								this.writeBuffer = null;
  						}

  						while (passes.length > 0) {

  								passes.pop().dispose();
  						}

  						if (renderTarget !== undefined) {
  								this.readBuffer = renderTarget;
  								this.writeBuffer = this.readBuffer.clone();
  						} else {

  								this.copyPass.dispose();
  						}
  				}
  		}, {
  				key: "depthTexture",
  				get: function get$$1() {

  						return this.readBuffer.depthTexture;
  				},
  				set: function set$$1(x) {

  						this.readBuffer.depthTexture = x;
  						this.writeBuffer.depthTexture = x;
  				}
  		}]);
  		return EffectComposer;
  }();

  function createCanvas(width, height, data, channels) {

  	var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
  	var context = canvas.getContext("2d");

  	var imageData = context.createImageData(width, height);
  	var target = imageData.data;

  	var x = void 0,
  	    y = void 0;
  	var i = void 0,
  	    j = void 0;

  	for (y = 0; y < height; ++y) {

  		for (x = 0; x < width; ++x) {

  			i = (y * width + x) * 4;
  			j = (y * width + x) * channels;

  			target[i] = channels > 0 ? data[j] : 0;
  			target[i + 1] = channels > 1 ? data[j + 1] : 0;
  			target[i + 2] = channels > 2 ? data[j + 2] : 0;
  			target[i + 3] = channels > 3 ? data[j + 3] : 255;
  		}
  	}

  	canvas.width = width;
  	canvas.height = height;

  	context.putImageData(imageData, 0, 0);

  	return canvas;
  }

  var RawImageData = function () {
  	function RawImageData() {
  		var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  		var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  		var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  		var channels = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 4;
  		classCallCheck(this, RawImageData);


  		this.width = width;

  		this.height = height;

  		this.data = data;

  		this.channels = channels;
  	}

  	createClass(RawImageData, [{
  		key: "toCanvas",
  		value: function toCanvas() {

  			return typeof document === "undefined" ? null : createCanvas(this.width, this.height, this.data, this.channels);
  		}
  	}]);
  	return RawImageData;
  }();

  var b0 = new three.Box2();

  var b1 = new three.Box2();

  var ORTHOGONAL_SIZE = 16;

  var DIAGONAL_SIZE = 20;

  var DIAGONAL_SAMPLES = 30;

  var SMOOTH_MAX_DISTANCE = 32;

  var orthogonalSubsamplingOffsets = new Float32Array([0.0, -0.25, 0.25, -0.125, 0.125, -0.375, 0.375]);

  var diagonalSubsamplingOffsets = [new Float32Array([0.0, 0.0]), new Float32Array([0.25, -0.25]), new Float32Array([-0.25, 0.25]), new Float32Array([0.125, -0.125]), new Float32Array([-0.125, 0.125])];

  var orthogonalEdges = [new Uint8Array([0, 0]), new Uint8Array([3, 0]), new Uint8Array([0, 3]), new Uint8Array([3, 3]), new Uint8Array([1, 0]), new Uint8Array([4, 0]), new Uint8Array([1, 3]), new Uint8Array([4, 3]), new Uint8Array([0, 1]), new Uint8Array([3, 1]), new Uint8Array([0, 4]), new Uint8Array([3, 4]), new Uint8Array([1, 1]), new Uint8Array([4, 1]), new Uint8Array([1, 4]), new Uint8Array([4, 4])];

  var diagonalEdges = [new Uint8Array([0, 0]), new Uint8Array([1, 0]), new Uint8Array([0, 2]), new Uint8Array([1, 2]), new Uint8Array([2, 0]), new Uint8Array([3, 0]), new Uint8Array([2, 2]), new Uint8Array([3, 2]), new Uint8Array([0, 1]), new Uint8Array([1, 1]), new Uint8Array([0, 3]), new Uint8Array([1, 3]), new Uint8Array([2, 1]), new Uint8Array([3, 1]), new Uint8Array([2, 3]), new Uint8Array([3, 3])];

  function lerp(a, b, p) {

  			return a + (b - a) * p;
  }

  function saturate(a) {

  			return Math.min(Math.max(a, 0.0), 1.0);
  }

  function smoothArea(d, b) {

  			var a1 = b.min;
  			var a2 = b.max;

  			var b1X = Math.sqrt(a1.x * 2.0) * 0.5;
  			var b1Y = Math.sqrt(a1.y * 2.0) * 0.5;
  			var b2X = Math.sqrt(a2.x * 2.0) * 0.5;
  			var b2Y = Math.sqrt(a2.y * 2.0) * 0.5;

  			var p = saturate(d / SMOOTH_MAX_DISTANCE);

  			a1.set(lerp(b1X, a1.x, p), lerp(b1Y, a1.y, p));
  			a2.set(lerp(b2X, a2.x, p), lerp(b2Y, a2.y, p));

  			return b;
  }

  function calculateOrthogonalArea(p1, p2, x, result) {

  			var dX = p2.x - p1.x;
  			var dY = p2.y - p1.y;

  			var x1 = x;
  			var x2 = x + 1.0;

  			var y1 = p1.y + dY * (x1 - p1.x) / dX;
  			var y2 = p1.y + dY * (x2 - p1.x) / dX;

  			var a = void 0,
  			    a1 = void 0,
  			    a2 = void 0,
  			    t = void 0;

  			if (x1 >= p1.x && x1 < p2.x || x2 > p1.x && x2 <= p2.x) {
  						if (Math.sign(y1) === Math.sign(y2) || Math.abs(y1) < 1e-4 || Math.abs(y2) < 1e-4) {

  									a = (y1 + y2) / 2.0;

  									if (a < 0.0) {

  												result.set(Math.abs(a), 0.0);
  									} else {

  												result.set(0.0, Math.abs(a));
  									}
  						} else {
  									t = -p1.y * dX / dY + p1.x;

  									a1 = t > p1.x ? y1 * (t - Math.trunc(t)) / 2.0 : 0.0;
  									a2 = t < p2.x ? y2 * (1.0 - (t - Math.trunc(t))) / 2.0 : 0.0;

  									a = Math.abs(a1) > Math.abs(a2) ? a1 : -a2;

  									if (a < 0.0) {

  												result.set(Math.abs(a1), Math.abs(a2));
  									} else {

  												result.set(Math.abs(a2), Math.abs(a1));
  									}
  						}
  			} else {

  						result.set(0, 0);
  			}

  			return result;
  }

  function calculateOrthogonalAreaForPattern(pattern, left, right, offset, result) {

  			var p1 = b0.min;
  			var p2 = b0.max;
  			var a1 = b1.min;
  			var a2 = b1.max;
  			var a = b1;

  			var o1 = 0.5 + offset;
  			var o2 = 0.5 + offset - 1.0;
  			var d = left + right + 1;

  			switch (pattern) {

  						case 0:
  									{

  												result.set(0, 0);

  												break;
  									}

  						case 1:
  									{

  												if (left <= right) {

  															calculateOrthogonalArea(p1.set(0.0, o2), p2.set(d / 2.0, 0.0), left, result);
  												} else {

  															result.set(0, 0);
  												}

  												break;
  									}

  						case 2:
  									{

  												if (left >= right) {

  															calculateOrthogonalArea(p1.set(d / 2.0, 0.0), p2.set(d, o2), left, result);
  												} else {

  															result.set(0, 0);
  												}

  												break;
  									}

  						case 3:
  									{

  												calculateOrthogonalArea(p1.set(0.0, o2), p2.set(d / 2.0, 0.0), left, a1);
  												calculateOrthogonalArea(p1.set(d / 2.0, 0.0), p2.set(d, o2), left, a2);

  												smoothArea(d, a);

  												result.addVectors(a1, a2);

  												break;
  									}

  						case 4:
  									{

  												if (left <= right) {

  															calculateOrthogonalArea(p1.set(0.0, o1), p2.set(d / 2.0, 0.0), left, result);
  												} else {

  															result.set(0, 0);
  												}

  												break;
  									}

  						case 5:
  									{

  												result.set(0, 0);

  												break;
  									}

  						case 6:
  									{

  												if (Math.abs(offset) > 0.0) {

  															calculateOrthogonalArea(p1.set(0.0, o1), p2.set(d, o2), left, a1);
  															calculateOrthogonalArea(p1.set(0.0, o1), p2.set(d / 2.0, 0.0), left, a2);
  															a2.add(calculateOrthogonalArea(p1.set(d / 2.0, 0.0), p2.set(d, o2), left, result));

  															result.addVectors(a1, a2).divideScalar(2.0);
  												} else {

  															calculateOrthogonalArea(p1.set(0.0, o1), p2.set(d, o2), left, result);
  												}

  												break;
  									}

  						case 7:
  									{

  												calculateOrthogonalArea(p1.set(0.0, o1), p2.set(d, o2), left, result);

  												break;
  									}

  						case 8:
  									{

  												if (left >= right) {

  															calculateOrthogonalArea(p1.set(d / 2.0, 0.0), p2.set(d, o1), left, result);
  												} else {

  															result.set(0, 0);
  												}

  												break;
  									}

  						case 9:
  									{

  												if (Math.abs(offset) > 0.0) {

  															calculateOrthogonalArea(p1.set(0.0, o2), p2.set(d, o1), left, a1);
  															calculateOrthogonalArea(p1.set(0.0, o2), p2.set(d / 2.0, 0.0), left, a2);
  															a2.add(calculateOrthogonalArea(p1.set(d / 2.0, 0.0), p2.set(d, o1), left, result));

  															result.addVectors(a1, a2).divideScalar(2.0);
  												} else {

  															calculateOrthogonalArea(p1.set(0.0, o2), p2.set(d, o1), left, result);
  												}

  												break;
  									}

  						case 10:
  									{

  												result.set(0, 0);

  												break;
  									}

  						case 11:
  									{

  												calculateOrthogonalArea(p1.set(0.0, o2), p2.set(d, o1), left, result);

  												break;
  									}

  						case 12:
  									{

  												calculateOrthogonalArea(p1.set(0.0, o1), p2.set(d / 2.0, 0.0), left, a1);
  												calculateOrthogonalArea(p1.set(d / 2.0, 0.0), p2.set(d, o1), left, a2);

  												smoothArea(d, a);

  												result.addVectors(a1, a2);

  												break;
  									}

  						case 13:
  									{

  												calculateOrthogonalArea(p1.set(0.0, o2), p2.set(d, o1), left, result);

  												break;
  									}

  						case 14:
  									{

  												calculateOrthogonalArea(p1.set(0.0, o1), p2.set(d, o2), left, result);

  												break;
  									}

  						case 15:
  									{

  												result.set(0, 0);

  												break;
  									}

  			}

  			return result;
  }

  function isInsideArea(p1, p2, x, y) {

  			var result = p1.equals(p2);

  			var xm = void 0,
  			    ym = void 0;
  			var a = void 0,
  			    b = void 0,
  			    c = void 0;

  			if (!result) {

  						xm = (p1.x + p2.x) / 2.0;
  						ym = (p1.y + p2.y) / 2.0;

  						a = p2.y - p1.y;
  						b = p1.x - p2.x;

  						c = a * (x - xm) + b * (y - ym);

  						result = c > 0.0;
  			}

  			return result;
  }

  function calculateDiagonalAreaForPixel(p1, p2, pX, pY) {

  			var a = void 0;
  			var x = void 0,
  			    y = void 0;
  			var offsetX = void 0,
  			    offsetY = void 0;

  			for (a = 0, y = 0; y < DIAGONAL_SAMPLES; ++y) {

  						for (x = 0; x < DIAGONAL_SAMPLES; ++x) {

  									offsetX = x / (DIAGONAL_SAMPLES - 1.0);
  									offsetY = y / (DIAGONAL_SAMPLES - 1.0);

  									if (isInsideArea(p1, p2, pX + offsetX, pY + offsetY)) {

  												++a;
  									}
  						}
  			}

  			return a / (DIAGONAL_SAMPLES * DIAGONAL_SAMPLES);
  }

  function calculateDiagonalArea(pattern, p1, p2, left, offset, result) {

  			var e = diagonalEdges[pattern];
  			var e1 = e[0];
  			var e2 = e[1];

  			if (e1 > 0) {

  						p1.x += offset[0];
  						p1.y += offset[1];
  			}

  			if (e2 > 0) {

  						p2.x += offset[0];
  						p2.y += offset[1];
  			}

  			return result.set(1.0 - calculateDiagonalAreaForPixel(p1, p2, 1.0 + left, 0.0 + left), calculateDiagonalAreaForPixel(p1, p2, 1.0 + left, 1.0 + left));
  }

  function calculateDiagonalAreaForPattern(pattern, left, right, offset, result) {

  			var p1 = b0.min;
  			var p2 = b0.max;
  			var a1 = b1.min;
  			var a2 = b1.max;

  			var d = left + right + 1;

  			switch (pattern) {

  						case 0:
  									{
  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(1.0 + d, 1.0 + d), left, offset, a1);

  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 0.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 1:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(0.0 + d, 0.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 0.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 2:
  									{

  												calculateDiagonalArea(pattern, p1.set(0.0, 0.0), p2.set(1.0 + d, 0.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 0.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 3:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 0.0 + d), left, offset, result);

  												break;
  									}

  						case 4:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(0.0 + d, 0.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(1.0 + d, 0.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 5:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(0.0 + d, 0.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 0.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 6:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(1.0 + d, 0.0 + d), left, offset, result);

  												break;
  									}

  						case 7:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(1.0 + d, 0.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 0.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 8:
  									{

  												calculateDiagonalArea(pattern, p1.set(0.0, 0.0), p2.set(1.0 + d, 1.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 1.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 9:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 1.0 + d), left, offset, result);

  												break;
  									}

  						case 10:
  									{

  												calculateDiagonalArea(pattern, p1.set(0.0, 0.0), p2.set(1.0 + d, 1.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 0.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 11:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 1.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 0.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 12:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(1.0 + d, 1.0 + d), left, offset, result);

  												break;
  									}

  						case 13:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(1.0 + d, 1.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 1.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 14:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(1.0 + d, 1.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(1.0 + d, 0.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  						case 15:
  									{

  												calculateDiagonalArea(pattern, p1.set(1.0, 1.0), p2.set(1.0 + d, 1.0 + d), left, offset, a1);
  												calculateDiagonalArea(pattern, p1.set(1.0, 0.0), p2.set(1.0 + d, 0.0 + d), left, offset, a2);

  												result.addVectors(a1, a2).divideScalar(2.0);

  												break;
  									}

  			}

  			return result;
  }

  function generatePatterns(patterns, offset, orthogonal) {

  			var result = new three.Vector2();

  			var i = void 0,
  			    l = void 0;
  			var x = void 0,
  			    y = void 0;
  			var c = void 0;

  			var pattern = void 0;
  			var data = void 0,
  			    size = void 0;

  			for (i = 0, l = patterns.length; i < l; ++i) {

  						pattern = patterns[i];

  						data = pattern.data;
  						size = pattern.width;

  						for (y = 0; y < size; ++y) {

  									for (x = 0; x < size; ++x) {

  												if (orthogonal) {

  															calculateOrthogonalAreaForPattern(i, x, y, offset, result);
  												} else {

  															calculateDiagonalAreaForPattern(i, x, y, offset, result);
  												}

  												c = (y * size + x) * 2;

  												data[c] = result.x * 255;
  												data[c + 1] = result.y * 255;
  									}
  						}
  			}
  }

  function assemble(base, patterns, edges, size, orthogonal, target) {

  			var p = new three.Vector2();

  			var dstData = target.data;
  			var dstWidth = target.width;

  			var i = void 0,
  			    l = void 0;
  			var x = void 0,
  			    y = void 0;
  			var c = void 0,
  			    d = void 0;

  			var edge = void 0;
  			var pattern = void 0;
  			var srcData = void 0,
  			    srcWidth = void 0;

  			for (i = 0, l = patterns.length; i < l; ++i) {

  						edge = edges[i];
  						pattern = patterns[i];

  						srcData = pattern.data;
  						srcWidth = pattern.width;

  						for (y = 0; y < size; ++y) {

  									for (x = 0; x < size; ++x) {

  												p.fromArray(edge).multiplyScalar(size);
  												p.add(base);
  												p.x += x;
  												p.y += y;

  												c = (p.y * dstWidth + p.x) * 2;

  												d = orthogonal ? (y * y * srcWidth + x * x) * 2 : (y * srcWidth + x) * 2;

  												dstData[c] = srcData[d];
  												dstData[c + 1] = srcData[d + 1];
  									}
  						}
  			}
  }

  var SMAAAreaImageData = function () {
  			function SMAAAreaImageData() {
  						classCallCheck(this, SMAAAreaImageData);
  			}

  			createClass(SMAAAreaImageData, null, [{
  						key: "generate",
  						value: function generate() {

  									var width = 2 * 5 * ORTHOGONAL_SIZE;
  									var height = orthogonalSubsamplingOffsets.length * 5 * ORTHOGONAL_SIZE;

  									var data = new Uint8ClampedArray(width * height * 2);
  									var result = new RawImageData(width, height, data, 2);

  									var orthogonalPatternSize = Math.pow(ORTHOGONAL_SIZE - 1, 2) + 1;
  									var diagonalPatternSize = DIAGONAL_SIZE;

  									var orthogonalPatterns = [];
  									var diagonalPatterns = [];

  									var base = new three.Vector2();

  									var i = void 0,
  									    l = void 0;

  									for (i = 0; i < 16; ++i) {

  												orthogonalPatterns.push(new RawImageData(orthogonalPatternSize, orthogonalPatternSize, new Uint8ClampedArray(orthogonalPatternSize * orthogonalPatternSize * 2), 2));

  												diagonalPatterns.push(new RawImageData(diagonalPatternSize, diagonalPatternSize, new Uint8ClampedArray(diagonalPatternSize * diagonalPatternSize * 2), 2));
  									}

  									for (i = 0, l = orthogonalSubsamplingOffsets.length; i < l; ++i) {
  												generatePatterns(orthogonalPatterns, orthogonalSubsamplingOffsets[i], true);

  												base.set(0, 5 * ORTHOGONAL_SIZE * i);
  												assemble(base, orthogonalPatterns, orthogonalEdges, ORTHOGONAL_SIZE, true, result);
  									}

  									for (i = 0, l = diagonalSubsamplingOffsets.length; i < l; ++i) {
  												generatePatterns(diagonalPatterns, diagonalSubsamplingOffsets[i], false);

  												base.set(5 * ORTHOGONAL_SIZE, 4 * DIAGONAL_SIZE * i);
  												assemble(base, diagonalPatterns, diagonalEdges, DIAGONAL_SIZE, false, result);
  									}

  									return result;
  						}
  			}]);
  			return SMAAAreaImageData;
  }();

  var edges = new Map([[bilinear([0, 0, 0, 0]), [0, 0, 0, 0]], [bilinear([0, 0, 0, 1]), [0, 0, 0, 1]], [bilinear([0, 0, 1, 0]), [0, 0, 1, 0]], [bilinear([0, 0, 1, 1]), [0, 0, 1, 1]], [bilinear([0, 1, 0, 0]), [0, 1, 0, 0]], [bilinear([0, 1, 0, 1]), [0, 1, 0, 1]], [bilinear([0, 1, 1, 0]), [0, 1, 1, 0]], [bilinear([0, 1, 1, 1]), [0, 1, 1, 1]], [bilinear([1, 0, 0, 0]), [1, 0, 0, 0]], [bilinear([1, 0, 0, 1]), [1, 0, 0, 1]], [bilinear([1, 0, 1, 0]), [1, 0, 1, 0]], [bilinear([1, 0, 1, 1]), [1, 0, 1, 1]], [bilinear([1, 1, 0, 0]), [1, 1, 0, 0]], [bilinear([1, 1, 0, 1]), [1, 1, 0, 1]], [bilinear([1, 1, 1, 0]), [1, 1, 1, 0]], [bilinear([1, 1, 1, 1]), [1, 1, 1, 1]]]);

  function lerp$1(a, b, p) {

  	return a + (b - a) * p;
  }

  function bilinear(e) {

  	var a = lerp$1(e[0], e[1], 1.0 - 0.25);
  	var b = lerp$1(e[2], e[3], 1.0 - 0.25);

  	return lerp$1(a, b, 1.0 - 0.125);
  }

  function deltaLeft(left, top) {

  	var d = 0;

  	if (top[3] === 1) {

  		d += 1;
  	}

  	if (d === 1 && top[2] === 1 && left[1] !== 1 && left[3] !== 1) {

  		d += 1;
  	}

  	return d;
  }

  function deltaRight(left, top) {

  	var d = 0;

  	if (top[3] === 1 && left[1] !== 1 && left[3] !== 1) {

  		d += 1;
  	}

  	if (d === 1 && top[2] === 1 && left[0] !== 1 && left[2] !== 1) {

  		d += 1;
  	}

  	return d;
  }

  var SMAASearchImageData = function () {
  	function SMAASearchImageData() {
  		classCallCheck(this, SMAASearchImageData);
  	}

  	createClass(SMAASearchImageData, null, [{
  		key: "generate",
  		value: function generate() {

  			var width = 66;
  			var height = 33;

  			var croppedWidth = 64;
  			var croppedHeight = 16;

  			var data = new Uint8ClampedArray(width * height);
  			var croppedData = new Uint8ClampedArray(croppedWidth * croppedHeight);

  			var x = void 0,
  			    y = void 0;
  			var s = void 0,
  			    t = void 0,
  			    i = void 0;
  			var e1 = void 0,
  			    e2 = void 0;

  			for (y = 0; y < height; ++y) {

  				for (x = 0; x < width; ++x) {

  					s = 0.03125 * x;
  					t = 0.03125 * y;

  					if (edges.has(s) && edges.has(t)) {

  						e1 = edges.get(s);
  						e2 = edges.get(t);

  						data[y * width + x] = 127 * deltaLeft(e1, e2);
  						data[y * width + x + width / 2] = 127 * deltaRight(e1, e2);
  					}
  				}
  			}

  			for (i = 0, y = height - croppedHeight; y < height; ++y) {

  				for (x = 0; x < croppedWidth; ++x, ++i) {

  					croppedData[i] = data[y * width + x];
  				}
  			}

  			return new RawImageData(croppedWidth, croppedHeight, croppedData, 1);
  		}
  	}]);
  	return SMAASearchImageData;
  }();

  var Demo = function () {
  		function Demo(composer) {
  				classCallCheck(this, Demo);


  				this.composer = composer;

  				this.loadingManager = new three.LoadingManager();

  				this.assets = null;

  				this.scene = new three.Scene();
  				this.scene.fog = new three.FogExp2(0x0d0d0d, 0.0025);

  				this.camera = new three.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 2000);

  				this.controls = null;
  		}

  		createClass(Demo, [{
  				key: "load",
  				value: function load(callback) {

  						callback();
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {}
  		}, {
  				key: "update",
  				value: function update(delta) {}
  		}, {
  				key: "configure",
  				value: function configure(gui) {}
  		}, {
  				key: "reset",
  				value: function reset() {

  						var fog = this.scene.fog;

  						this.scene = new three.Scene();
  						this.scene.fog = fog;

  						if (this.controls !== null) {

  								this.controls.dispose();
  								this.controls = null;
  						}

  						return this;
  				}
  		}]);
  		return Demo;
  }();

  var TWO_PI = 2.0 * Math.PI;

  var BloomDemo = function (_Demo) {
  		inherits(BloomDemo, _Demo);

  		function BloomDemo(composer) {
  				classCallCheck(this, BloomDemo);

  				var _this = possibleConstructorReturn(this, (BloomDemo.__proto__ || Object.getPrototypeOf(BloomDemo)).call(this, composer));

  				_this.bloomPass = null;

  				_this.object = null;

  				return _this;
  		}

  		createClass(BloomDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/space2/";
  						var format = ".jpg";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);

  						camera.position.set(-10, 6, 15);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(-1, 1, 1);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var object = new three.Object3D();

  						var geometry = new three.SphereBufferGeometry(1, 4, 4);
  						var material = void 0;
  						var i = void 0,
  						    mesh = void 0;

  						for (i = 0; i < 100; ++i) {

  								material = new three.MeshPhongMaterial({
  										color: 0xffffff * Math.random(),
  										flatShading: true
  								});

  								mesh = new three.Mesh(geometry, material);
  								mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize();
  								mesh.position.multiplyScalar(Math.random() * 4);
  								mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2);
  								mesh.scale.multiplyScalar(Math.random() * 0.5);
  								object.add(mesh);
  						}

  						this.object = object;

  						scene.add(object);

  						mesh = new three.Mesh(new three.BoxBufferGeometry(0.25, 8.25, 0.25), new three.MeshLambertMaterial({
  								color: 0x0b0b0b
  						}));

  						object = new three.Object3D();
  						var o0 = void 0,
  						    o1 = void 0,
  						    o2 = void 0;

  						o0 = object.clone();

  						var clone = mesh.clone();
  						clone.position.set(-4, 0, 4);
  						o0.add(clone);
  						clone = mesh.clone();
  						clone.position.set(4, 0, 4);
  						o0.add(clone);
  						clone = mesh.clone();
  						clone.position.set(-4, 0, -4);
  						o0.add(clone);
  						clone = mesh.clone();
  						clone.position.set(4, 0, -4);
  						o0.add(clone);

  						o1 = o0.clone();
  						o1.rotation.set(Math.PI / 2, 0, 0);
  						o2 = o0.clone();
  						o2.rotation.set(0, 0, Math.PI / 2);

  						object.add(o0);
  						object.add(o1);
  						object.add(o2);

  						scene.add(object);

  						composer.addPass(new RenderPass(scene, camera));

  						var pass = new BloomPass({
  								resolutionScale: 0.5,
  								intensity: 2.0,
  								distinction: 4.0
  						});

  						pass.renderToScreen = true;
  						this.bloomPass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "update",
  				value: function update(delta) {

  						var object = this.object;

  						if (object !== null) {

  								object.rotation.x += 0.001;
  								object.rotation.y += 0.005;

  								if (object.rotation.x >= TWO_PI) {

  										object.rotation.x -= TWO_PI;
  								}

  								if (object.rotation.y >= TWO_PI) {

  										object.rotation.y -= TWO_PI;
  								}
  						}
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var composer = this.composer;
  						var pass = this.bloomPass;

  						var params = {
  								"resolution": pass.resolutionScale,
  								"kernel size": pass.kernelSize,
  								"intensity": pass.intensity,
  								"distinction": pass.distinction,
  								"blend": true,
  								"blend mode": "screen"
  						};

  						gui.add(params, "resolution").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.resolutionScale = params.resolution;
  								composer.setSize();
  						});

  						gui.add(params, "kernel size").min(KernelSize.VERY_SMALL).max(KernelSize.HUGE).step(1).onChange(function () {

  								pass.kernelSize = params["kernel size"];
  						});

  						gui.add(params, "intensity").min(0.0).max(3.0).step(0.01).onChange(function () {

  								pass.intensity = params.intensity;
  						});

  						var folder = gui.addFolder("Luminance");

  						folder.add(params, "distinction").min(1.0).max(10.0).step(0.1).onChange(function () {

  								pass.distinction = params.distinction;
  						});

  						folder.open();

  						gui.add(params, "blend").onChange(function () {

  								pass.combineMaterial.uniforms.opacity1.value = params.blend ? 1.0 : 0.0;
  						});

  						gui.add(params, "blend mode", ["add", "screen"]).onChange(function () {

  								pass.combineMaterial.setScreenModeEnabled(params["blend mode"] !== "add");
  						});
  				}
  		}]);
  		return BloomDemo;
  }(Demo);

  var BokehDemo = function (_Demo) {
  		inherits(BokehDemo, _Demo);

  		function BokehDemo(composer) {
  				classCallCheck(this, BokehDemo);

  				var _this = possibleConstructorReturn(this, (BokehDemo.__proto__ || Object.getPrototypeOf(BokehDemo)).call(this, composer));

  				_this.bokehPass = null;

  				return _this;
  		}

  		createClass(BokehDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/space3/";
  						var format = ".jpg";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);
  						this.controls.enablePan = false;
  						this.controls.minDistance = 12;
  						this.controls.maxDistance = 40;
  						this.controls.zoomSpeed = 0.2;
  						this.controls.rotateSpeed = 0.2;

  						camera.near = 1;
  						camera.far = 50;
  						camera.position.set(12.5, -0.3, 1.7);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x404040);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(-1, 1, 1);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var geometry = new three.CylinderBufferGeometry(1, 1, 20, 6);
  						var material = new three.MeshPhongMaterial({
  								color: 0xffaaaa,
  								flatShading: true,
  								envMap: assets.get("sky")
  						});

  						var mesh = new three.Mesh(geometry, material);
  						mesh.rotation.set(0, 0, Math.PI / 2);
  						scene.add(mesh);

  						composer.addPass(new RenderPass(scene, camera));

  						var pass = new BokehPass(camera, {
  								focus: 0.32,
  								dof: 0.02,
  								aperture: 0.015,
  								maxBlur: 0.025
  						});

  						pass.renderToScreen = true;
  						this.bokehPass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var pass = this.bokehPass;

  						var params = {
  								"focus": pass.bokehMaterial.uniforms.focus.value,
  								"dof": pass.bokehMaterial.uniforms.dof.value,
  								"aperture": pass.bokehMaterial.uniforms.aperture.value,
  								"blur": pass.bokehMaterial.uniforms.maxBlur.value
  						};

  						gui.add(params, "focus").min(0.0).max(1.0).step(0.001).onChange(function () {

  								pass.bokehMaterial.uniforms.focus.value = params.focus;
  						});

  						gui.add(params, "dof").min(0.0).max(1.0).step(0.001).onChange(function () {

  								pass.bokehMaterial.uniforms.dof.value = params.dof;
  						});

  						gui.add(params, "aperture").min(0.0).max(0.05).step(0.0001).onChange(function () {

  								pass.bokehMaterial.uniforms.aperture.value = params.aperture;
  						});

  						gui.add(params, "blur").min(0.0).max(0.1).step(0.001).onChange(function () {

  								pass.bokehMaterial.uniforms.maxBlur.value = params.blur;
  						});
  				}
  		}]);
  		return BokehDemo;
  }(Demo);

  var Bokeh2Demo = function (_Demo) {
  		inherits(Bokeh2Demo, _Demo);

  		function Bokeh2Demo(composer) {
  				classCallCheck(this, Bokeh2Demo);

  				var _this = possibleConstructorReturn(this, (Bokeh2Demo.__proto__ || Object.getPrototypeOf(Bokeh2Demo)).call(this, composer));

  				_this.bokehPass = null;

  				return _this;
  		}

  		createClass(Bokeh2Demo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/space3/";
  						var format = ".jpg";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);
  						this.controls.enablePan = false;
  						this.controls.minDistance = 2.5;
  						this.controls.maxDistance = 40;

  						camera.near = 0.01;
  						camera.far = 50;
  						camera.position.set(3, 1, 3);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(-1, 1, 1);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var geometry = new three.SphereBufferGeometry(1, 64, 64);
  						var material = new three.MeshBasicMaterial({
  								color: 0xffff00,
  								envMap: assets.get("sky")
  						});

  						var mesh = new three.Mesh(geometry, material);
  						scene.add(mesh);

  						composer.addPass(new RenderPass(scene, camera));

  						var pass = new Bokeh2Pass(camera, {
  								rings: 3,
  								samples: 2,
  								showFocus: false,
  								manualDoF: true,
  								vignette: false,
  								pentagon: false,
  								shaderFocus: true,
  								noise: true
  						});

  						pass.renderToScreen = true;
  						this.bokehPass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var pass = this.bokehPass;

  						var params = {
  								"rings": Number.parseInt(pass.bokehMaterial.defines.RINGS_INT),
  								"samples": Number.parseInt(pass.bokehMaterial.defines.SAMPLES_INT),
  								"focal stop": pass.bokehMaterial.uniforms.focalStop.value,
  								"focal length": pass.bokehMaterial.uniforms.focalLength.value,
  								"shader focus": pass.bokehMaterial.defines.SHADER_FOCUS !== undefined,
  								"focal depth": pass.bokehMaterial.uniforms.focalDepth.value,
  								"focus coord X": pass.bokehMaterial.uniforms.focusCoords.value.x,
  								"focus coord Y": pass.bokehMaterial.uniforms.focusCoords.value.y,
  								"max blur": pass.bokehMaterial.uniforms.maxBlur.value,
  								"lum threshold": pass.bokehMaterial.uniforms.luminanceThreshold.value,
  								"lum gain": pass.bokehMaterial.uniforms.luminanceGain.value,
  								"bias": pass.bokehMaterial.uniforms.bias.value,
  								"fringe": pass.bokehMaterial.uniforms.fringe.value,
  								"dithering": pass.bokehMaterial.uniforms.ditherStrength.value,
  								"vignette": pass.bokehMaterial.defines.VIGNETTE !== undefined,
  								"pentagon": pass.bokehMaterial.defines.PENTAGON !== undefined,
  								"manual DoF": pass.bokehMaterial.defines.MANUAL_DOF !== undefined,
  								"show focus": pass.bokehMaterial.defines.SHOW_FOCUS !== undefined,
  								"noise": pass.bokehMaterial.defines.NOISE !== undefined
  						};

  						var f = gui.addFolder("Focus");

  						f.add(params, "show focus").onChange(function () {

  								pass.bokehMaterial.setShowFocusEnabled(params["show focus"]);
  						});

  						f.add(params, "shader focus").onChange(function () {

  								pass.bokehMaterial.setShaderFocusEnabled(params["shader focus"]);
  						});

  						f.add(params, "manual DoF").onChange(function () {

  								pass.bokehMaterial.setManualDepthOfFieldEnabled(params["manual DoF"]);
  						});

  						f.add(params, "focal stop").min(0.0).max(100.0).step(0.1).onChange(function () {

  								pass.bokehMaterial.uniforms.focalStop.value = params["focal stop"];
  						});

  						f.add(params, "focal depth").min(0.1).max(35.0).step(0.1).onChange(function () {

  								pass.bokehMaterial.uniforms.focalDepth.value = params["focal depth"];
  						});

  						f.add(params, "focus coord X").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.bokehMaterial.uniforms.focusCoords.value.x = params["focus coord X"];
  						});

  						f.add(params, "focus coord Y").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.bokehMaterial.uniforms.focusCoords.value.y = params["focus coord Y"];
  						});

  						f.open();

  						f = gui.addFolder("Sampling");

  						f.add(params, "rings").min(1).max(6).step(1).onChange(function () {

  								pass.bokehMaterial.defines.RINGS_INT = params.rings.toFixed(0);
  								pass.bokehMaterial.defines.RINGS_FLOAT = params.rings.toFixed(1);
  								pass.bokehMaterial.needsUpdate = true;
  						});

  						f.add(params, "samples").min(1).max(6).step(1).onChange(function () {

  								pass.bokehMaterial.defines.SAMPLES_INT = params.samples.toFixed(0);
  								pass.bokehMaterial.defines.SAMPLES_FLOAT = params.samples.toFixed(1);
  								pass.bokehMaterial.needsUpdate = true;
  						});

  						f = gui.addFolder("Blur");

  						f.add(params, "max blur").min(0.0).max(10.0).step(0.001).onChange(function () {

  								pass.bokehMaterial.uniforms.maxBlur.value = params["max blur"];
  						});

  						f.add(params, "bias").min(0.0).max(3.0).step(0.01).onChange(function () {

  								pass.bokehMaterial.uniforms.bias.value = params.bias;
  						});

  						f.add(params, "fringe").min(0.0).max(2.0).step(0.05).onChange(function () {

  								pass.bokehMaterial.uniforms.fringe.value = params.fringe;
  						});

  						f.add(params, "noise").onChange(function () {

  								pass.bokehMaterial.setNoiseEnabled(params.noise);
  						});

  						f.add(params, "dithering").min(0.0).max(0.01).step(0.0001).onChange(function () {

  								pass.bokehMaterial.uniforms.ditherStrength.value = params.dithering;
  						});

  						f.add(params, "pentagon").onChange(function () {

  								pass.bokehMaterial.setPentagonEnabled(params.pentagon);
  						});

  						f.open();

  						f = gui.addFolder("Luminosity");

  						f.add(params, "lum threshold").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.bokehMaterial.uniforms.luminanceThreshold.value = params["lum threshold"];
  						});

  						f.add(params, "lum gain").min(0.0).max(4.0).step(0.01).onChange(function () {

  								pass.bokehMaterial.uniforms.luminanceGain.value = params["lum gain"];
  						});

  						gui.add(params, "vignette").onChange(function () {

  								pass.bokehMaterial.setVignetteEnabled(params.vignette);
  						});
  				}
  		}]);
  		return Bokeh2Demo;
  }(Demo);

  var TWO_PI$1 = 2.0 * Math.PI;

  var BlurDemo = function (_Demo) {
  		inherits(BlurDemo, _Demo);

  		function BlurDemo(composer) {
  				classCallCheck(this, BlurDemo);

  				var _this = possibleConstructorReturn(this, (BlurDemo.__proto__ || Object.getPrototypeOf(BlurDemo)).call(this, composer));

  				_this.renderPass = null;

  				_this.savePass = null;

  				_this.blurPass = null;

  				_this.combinePass = null;

  				_this.object = null;

  				return _this;
  		}

  		createClass(BlurDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/sunset/";
  						var format = ".png";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);

  						camera.position.set(-15, 0, -15);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(1440, 200, 2000);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var object = new three.Object3D();

  						var geometry = new three.SphereBufferGeometry(1, 4, 4);
  						var material = void 0;
  						var i = void 0,
  						    mesh = void 0;

  						for (i = 0; i < 100; ++i) {

  								material = new three.MeshPhongMaterial({
  										color: 0xffffff * Math.random(),
  										flatShading: true
  								});

  								mesh = new three.Mesh(geometry, material);
  								mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize();
  								mesh.position.multiplyScalar(Math.random() * 10);
  								mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2);
  								mesh.scale.multiplyScalar(Math.random());
  								object.add(mesh);
  						}

  						this.object = object;

  						scene.add(object);

  						var pass = new RenderPass(scene, camera);
  						this.renderPass = pass;
  						composer.addPass(pass);

  						pass = new SavePass();
  						this.savePass = pass;
  						composer.addPass(pass);

  						pass = new BlurPass();
  						this.blurPass = pass;
  						composer.addPass(pass);

  						pass = new ShaderPass(new CombineMaterial(), "texture1");
  						pass.material.uniforms.texture2.value = this.savePass.renderTarget.texture;
  						pass.material.uniforms.opacity1.value = 1.0;
  						pass.material.uniforms.opacity2.value = 0.0;
  						pass.renderToScreen = true;
  						this.combinePass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "update",
  				value: function update(delta) {

  						var object = this.object;

  						if (object !== null) {

  								object.rotation.x += 0.001;
  								object.rotation.y += 0.005;

  								if (object.rotation.x >= TWO_PI$1) {

  										object.rotation.x -= TWO_PI$1;
  								}

  								if (object.rotation.y >= TWO_PI$1) {

  										object.rotation.y -= TWO_PI$1;
  								}
  						}
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var composer = this.composer;
  						var renderPass = this.renderPass;
  						var blurPass = this.blurPass;
  						var combinePass = this.combinePass;

  						var params = {
  								"enabled": blurPass.enabled,
  								"resolution": blurPass.resolutionScale,
  								"kernel size": blurPass.kernelSize,
  								"strength": combinePass.material.uniforms.opacity1.value
  						};

  						gui.add(params, "resolution").min(0.0).max(1.0).step(0.01).onChange(function () {

  								blurPass.resolutionScale = params.resolution;composer.setSize();
  						});

  						gui.add(params, "kernel size").min(KernelSize.VERY_SMALL).max(KernelSize.HUGE).step(1).onChange(function () {

  								blurPass.kernelSize = params["kernel size"];
  						});

  						gui.add(params, "strength").min(0.0).max(1.0).step(0.01).onChange(function () {

  								combinePass.material.uniforms.opacity1.value = params.strength;
  								combinePass.material.uniforms.opacity2.value = 1.0 - params.strength;
  						});

  						gui.add(params, "enabled").onChange(function () {

  								renderPass.renderToScreen = !params.enabled;
  								blurPass.enabled = params.enabled;
  								combinePass.enabled = params.enabled;
  						});
  				}
  		}]);
  		return BlurDemo;
  }(Demo);

  var TWO_PI$2 = 2.0 * Math.PI;

  var DepthDemo = function (_Demo) {
  		inherits(DepthDemo, _Demo);

  		function DepthDemo(composer) {
  				classCallCheck(this, DepthDemo);

  				var _this = possibleConstructorReturn(this, (DepthDemo.__proto__ || Object.getPrototypeOf(DepthDemo)).call(this, composer));

  				_this.object = null;

  				return _this;
  		}

  		createClass(DepthDemo, [{
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);
  						this.controls.enablePan = false;
  						this.controls.minDistance = 3;
  						this.controls.maxDistance = 9;

  						camera.near = 2;
  						camera.far = 10;
  						camera.updateProjectionMatrix();
  						camera.position.set(2, 1, 2);
  						camera.lookAt(this.controls.target);

  						var mesh = new three.Mesh(new three.DodecahedronBufferGeometry(1), new three.MeshBasicMaterial());

  						this.object = mesh;
  						scene.add(mesh);

  						composer.addPass(new RenderPass(scene, camera));

  						var pass = new RenderPass(scene, camera, {
  								overrideMaterial: new three.MeshDepthMaterial()
  						});

  						pass.renderToScreen = true;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "update",
  				value: function update(delta) {

  						var object = this.object;

  						if (object !== null) {

  								object.rotation.x += 0.001;
  								object.rotation.y += 0.005;

  								if (object.rotation.x >= TWO_PI$2) {

  										object.rotation.x -= TWO_PI$2;
  								}

  								if (object.rotation.y >= TWO_PI$2) {

  										object.rotation.y -= TWO_PI$2;
  								}
  						}
  				}
  		}]);
  		return DepthDemo;
  }(Demo);

  var TWO_PI$3 = 2.0 * Math.PI;

  var DotScreenDemo = function (_Demo) {
  		inherits(DotScreenDemo, _Demo);

  		function DotScreenDemo(composer) {
  				classCallCheck(this, DotScreenDemo);

  				var _this = possibleConstructorReturn(this, (DotScreenDemo.__proto__ || Object.getPrototypeOf(DotScreenDemo)).call(this, composer));

  				_this.dotScreenPass = null;

  				_this.object = null;

  				return _this;
  		}

  		createClass(DotScreenDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/space3/";
  						var format = ".jpg";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);

  						camera.position.set(10, 1, 10);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(-1, 1, 1);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var object = new three.Object3D();
  						var geometry = new three.SphereBufferGeometry(1, 4, 4);

  						var material = void 0,
  						    mesh = void 0;
  						var i = void 0;

  						for (i = 0; i < 100; ++i) {

  								material = new three.MeshPhongMaterial({
  										color: 0xffffff * Math.random(),
  										flatShading: true
  								});

  								mesh = new three.Mesh(geometry, material);
  								mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize();
  								mesh.position.multiplyScalar(Math.random() * 10);
  								mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2);
  								mesh.scale.multiplyScalar(Math.random());
  								object.add(mesh);
  						}

  						this.object = object;
  						scene.add(object);

  						composer.addPass(new RenderPass(scene, camera));

  						var pass = new DotScreenPass({
  								scale: 0.8,
  								angle: Math.PI * 0.5,
  								intensity: 0.25
  						});

  						pass.renderToScreen = true;
  						this.dotScreenPass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "update",
  				value: function update(delta) {

  						var object = this.object;

  						if (object !== null) {

  								object.rotation.x += 0.0005;
  								object.rotation.y += 0.001;

  								if (object.rotation.x >= TWO_PI$3) {

  										object.rotation.x -= TWO_PI$3;
  								}

  								if (object.rotation.y >= TWO_PI$3) {

  										object.rotation.y -= TWO_PI$3;
  								}
  						}
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var pass = this.dotScreenPass;

  						var params = {
  								"average": pass.material.defines.AVERAGE !== undefined,
  								"scale": pass.material.uniforms.scale.value,
  								"angle": pass.material.uniforms.angle.value,
  								"intensity": pass.material.uniforms.intensity.value,
  								"center X": pass.material.uniforms.offsetRepeat.value.x,
  								"center Y": pass.material.uniforms.offsetRepeat.value.y
  						};

  						gui.add(params, "average").onChange(function () {

  								pass.material.setAverageEnabled(params.average);
  						});

  						gui.add(params, "scale").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.material.uniforms.scale.value = params.scale;
  						});

  						gui.add(params, "angle").min(0.0).max(Math.PI).step(0.001).onChange(function () {

  								pass.material.uniforms.angle.value = params.angle;
  						});

  						gui.add(params, "intensity").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.material.uniforms.intensity.value = params.intensity;
  						});

  						var f = gui.addFolder("Center");

  						f.add(params, "center X").min(-1.0).max(1.0).step(0.01).onChange(function () {

  								pass.material.uniforms.offsetRepeat.value.x = params["center X"];
  						});

  						f.add(params, "center Y").min(-1.0).max(1.0).step(0.01).onChange(function () {

  								pass.material.uniforms.offsetRepeat.value.y = params["center Y"];
  						});
  				}
  		}]);
  		return DotScreenDemo;
  }(Demo);

  var TWO_PI$4 = 2.0 * Math.PI;

  var FilmDemo = function (_Demo) {
  		inherits(FilmDemo, _Demo);

  		function FilmDemo(composer) {
  				classCallCheck(this, FilmDemo);

  				var _this = possibleConstructorReturn(this, (FilmDemo.__proto__ || Object.getPrototypeOf(FilmDemo)).call(this, composer));

  				_this.filmPass = null;

  				_this.object = null;

  				return _this;
  		}

  		createClass(FilmDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/space/";
  						var format = ".jpg";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);

  						camera.position.set(10, 1, 10);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(-1, 1, 1);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var object = new three.Object3D();
  						var geometry = new three.SphereBufferGeometry(1, 4, 4);

  						var material = void 0,
  						    mesh = void 0;
  						var i = void 0;

  						for (i = 0; i < 100; ++i) {

  								material = new three.MeshPhongMaterial({
  										color: 0xffffff * Math.random(),
  										flatShading: true
  								});

  								mesh = new three.Mesh(geometry, material);
  								mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize();
  								mesh.position.multiplyScalar(Math.random() * 10);
  								mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2);
  								mesh.scale.multiplyScalar(Math.random());
  								object.add(mesh);
  						}

  						this.object = object;
  						scene.add(object);

  						composer.addPass(new RenderPass(scene, camera));

  						var pass = new FilmPass({
  								grayscale: false,
  								sepia: true,
  								vignette: true,
  								eskil: true,
  								scanlines: true,
  								noise: true,
  								noiseIntensity: 0.5,
  								scanlineIntensity: 0.5,
  								scanlineDensity: 1.5,
  								greyscaleIntensity: 1.0,
  								sepiaIntensity: 0.5,
  								vignetteOffset: 1.0,
  								vignetteDarkness: 1.0
  						});

  						pass.renderToScreen = true;
  						this.filmPass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "update",
  				value: function update(delta) {

  						var object = this.object;

  						if (object !== null) {

  								object.rotation.x += 0.001;
  								object.rotation.y += 0.005;

  								if (object.rotation.x >= TWO_PI$4) {

  										object.rotation.x -= TWO_PI$4;
  								}

  								if (object.rotation.y >= TWO_PI$4) {

  										object.rotation.y -= TWO_PI$4;
  								}
  						}
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var composer = this.composer;
  						var pass = this.filmPass;

  						var params = {
  								"greyscale": pass.material.defines.GREYSCALE !== undefined,
  								"sepia": pass.material.defines.SEPIA !== undefined,
  								"vignette": pass.material.defines.VIGNETTE !== undefined,
  								"eskil": pass.material.defines.ESKIL !== undefined,
  								"noise": pass.material.defines.NOISE !== undefined,
  								"scanlines": pass.material.defines.SCANLINES !== undefined,
  								"noise intensity": pass.material.uniforms.noiseIntensity.value,
  								"scanlines intensity": pass.material.uniforms.scanlineIntensity.value,
  								"scanlines count": pass.scanlineDensity,
  								"blend mode": "screen",
  								"greyscale intensity": pass.material.uniforms.greyscaleIntensity.value,
  								"sepia intensity": pass.material.uniforms.sepiaIntensity.value,
  								"vignette offset": pass.material.uniforms.vignetteOffset.value,
  								"vignette darkness": pass.material.uniforms.vignetteDarkness.value
  						};

  						var f = gui.addFolder("Greyscale");

  						f.add(params, "greyscale").onChange(function () {

  								pass.material.setGreyscaleEnabled(params.greyscale);
  						});

  						f.add(params, "greyscale intensity").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.material.uniforms.greyscaleIntensity.value = params["greyscale intensity"];
  						});

  						f.open();

  						f = gui.addFolder("Noise and scanlines");

  						f.add(params, "blend mode", ["add", "screen"]).onChange(function () {

  								pass.material.setScreenModeEnabled(params["blend mode"] !== "add");
  						});

  						f.add(params, "noise").onChange(function () {

  								pass.material.setNoiseEnabled(params.noise);
  						});

  						f.add(params, "noise intensity").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.material.uniforms.noiseIntensity.value = params["noise intensity"];
  						});

  						f.add(params, "scanlines").onChange(function () {

  								pass.material.setScanlinesEnabled(params.scanlines);
  						});

  						f.add(params, "scanlines intensity").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.material.uniforms.scanlineIntensity.value = params["scanlines intensity"];
  						});

  						f.add(params, "scanlines count").min(0.0).max(2.0).step(0.01).onChange(function () {

  								pass.scanlineDensity = params["scanlines count"];composer.setSize();
  						});

  						f.open();

  						f = gui.addFolder("Sepia");

  						f.add(params, "sepia").onChange(function () {

  								pass.material.setSepiaEnabled(params.sepia);
  						});

  						f.add(params, "sepia intensity").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.material.uniforms.sepiaIntensity.value = params["sepia intensity"];
  						});

  						f.open();

  						f = gui.addFolder("Vignette");

  						f.add(params, "vignette").onChange(function () {

  								pass.material.setVignetteEnabled(params.vignette);
  						});

  						f.add(params, "eskil").onChange(function () {

  								pass.material.setEskilEnabled(params.eskil);
  						});

  						f.add(params, "vignette offset").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.material.uniforms.vignetteOffset.value = params["vignette offset"];
  						});

  						f.add(params, "vignette darkness").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.material.uniforms.vignetteDarkness.value = params["vignette darkness"];
  						});

  						f.open();
  				}
  		}]);
  		return FilmDemo;
  }(Demo);

  var TWO_PI$5 = 2.0 * Math.PI;

  var GlitchDemo = function (_Demo) {
  		inherits(GlitchDemo, _Demo);

  		function GlitchDemo(composer) {
  				classCallCheck(this, GlitchDemo);

  				var _this = possibleConstructorReturn(this, (GlitchDemo.__proto__ || Object.getPrototypeOf(GlitchDemo)).call(this, composer));

  				_this.glitchPass = null;

  				_this.object = null;

  				return _this;
  		}

  		createClass(GlitchDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var textureLoader = new three.TextureLoader(loadingManager);
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/space4/";
  						var format = ".jpg";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});

  								textureLoader.load("textures/perturb.jpg", function (texture) {

  										texture.magFilter = texture.minFilter = three.NearestFilter;
  										assets.set("perturb-map", texture);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);

  						camera.position.set(6, 1, 6);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(-1, 1, 1);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var object = new three.Object3D();
  						var geometry = new three.SphereBufferGeometry(1, 4, 4);

  						var material = void 0,
  						    mesh = void 0;
  						var i = void 0;

  						for (i = 0; i < 100; ++i) {

  								material = new three.MeshPhongMaterial({
  										color: 0xffffff * Math.random(),
  										flatShading: true
  								});

  								mesh = new three.Mesh(geometry, material);
  								mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize();
  								mesh.position.multiplyScalar(Math.random() * 10);
  								mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2);
  								mesh.scale.multiplyScalar(Math.random());
  								object.add(mesh);
  						}

  						this.object = object;
  						scene.add(object);

  						composer.addPass(new RenderPass(scene, camera));

  						var pass = new GlitchPass({
  								perturbMap: assets.get("perturb-map")
  						});

  						pass.renderToScreen = true;
  						this.glitchPass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "update",
  				value: function update(delta) {

  						var object = this.object;

  						if (object !== null) {

  								object.rotation.x += 0.005;
  								object.rotation.y += 0.01;

  								if (object.rotation.x >= TWO_PI$5) {

  										object.rotation.x -= TWO_PI$5;
  								}

  								if (object.rotation.y >= TWO_PI$5) {

  										object.rotation.y -= TWO_PI$5;
  								}
  						}
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var pass = this.glitchPass;
  						var perturbMap = pass.perturbMap;

  						var params = {
  								"mode": pass.mode,
  								"custom noise": true
  						};

  						gui.add(params, "mode").min(GlitchMode.SPORADIC).max(GlitchMode.CONSTANT_WILD).step(1).onChange(function () {

  								pass.mode = params.mode;
  						});

  						gui.add(params, "custom noise").onChange(function () {

  								if (params["custom noise"]) {

  										pass.perturbMap = perturbMap;
  								} else {

  										pass.generatePerturbMap(64);
  								}
  						});
  				}
  		}]);
  		return GlitchDemo;
  }(Demo);

  var TWO_PI$6 = 2.0 * Math.PI;

  var PixelationDemo = function (_Demo) {
  		inherits(PixelationDemo, _Demo);

  		function PixelationDemo(composer) {
  				classCallCheck(this, PixelationDemo);

  				var _this = possibleConstructorReturn(this, (PixelationDemo.__proto__ || Object.getPrototypeOf(PixelationDemo)).call(this, composer));

  				_this.object = null;

  				_this.maskObject = null;

  				_this.maskPass = null;

  				_this.pixelationPass = null;

  				return _this;
  		}

  		createClass(PixelationDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/space/";
  						var format = ".jpg";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);

  						camera.position.set(10, 1, 10);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(-1, 1, 1);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var object = new three.Object3D();
  						var geometry = new three.SphereBufferGeometry(1, 4, 4);

  						var material = void 0,
  						    mesh = void 0;
  						var i = void 0;

  						for (i = 0; i < 100; ++i) {

  								material = new three.MeshPhongMaterial({
  										color: 0xffffff * Math.random(),
  										flatShading: true
  								});

  								mesh = new three.Mesh(geometry, material);
  								mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize();
  								mesh.position.multiplyScalar(Math.random() * 10);
  								mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2);
  								mesh.scale.multiplyScalar(Math.random());
  								object.add(mesh);
  						}

  						this.object = object;
  						scene.add(object);

  						var maskScene = new three.Scene();

  						mesh = new three.Mesh(new three.BoxBufferGeometry(4, 4, 4));
  						this.maskObject = mesh;
  						maskScene.add(mesh);

  						var pass = new RenderPass(scene, camera);
  						composer.addPass(pass);

  						pass = new MaskPass(maskScene, camera);
  						this.maskPass = pass;
  						composer.addPass(pass);

  						pass = new PixelationPass(5.0);
  						this.pixelationPass = pass;
  						composer.addPass(pass);

  						composer.addPass(new ClearMaskPass());

  						pass = new ShaderPass(new CopyMaterial());
  						pass.renderToScreen = true;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "update",
  				value: function update(delta) {

  						var object = this.object;
  						var maskObject = this.maskObject;

  						var time = void 0;

  						if (object !== null && maskObject !== null) {

  								object.rotation.x += 0.001;
  								object.rotation.y += 0.005;

  								if (object.rotation.x >= TWO_PI$6) {

  										object.rotation.x -= TWO_PI$6;
  								}

  								if (object.rotation.y >= TWO_PI$6) {

  										object.rotation.y -= TWO_PI$6;
  								}

  								time = performance.now() * 0.001;

  								maskObject.position.x = Math.cos(time / 1.5) * 4;
  								maskObject.position.y = Math.sin(time) * 4;
  								maskObject.rotation.x = time;
  								maskObject.rotation.y = time * 0.5;
  						}
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var maskPass = this.maskPass;

  						var params = {
  								"use mask": maskPass.enabled
  						};

  						gui.add(this.pixelationPass, "granularity").min(0.0).max(50.0).step(0.1);

  						gui.add(params, "use mask").onChange(function () {

  								maskPass.enabled = params["use mask"];
  						});
  				}
  		}]);
  		return PixelationDemo;
  }(Demo);

  var GodRaysDemo = function (_Demo) {
  		inherits(GodRaysDemo, _Demo);

  		function GodRaysDemo(composer) {
  				classCallCheck(this, GodRaysDemo);

  				var _this = possibleConstructorReturn(this, (GodRaysDemo.__proto__ || Object.getPrototypeOf(GodRaysDemo)).call(this, composer));

  				_this.godRaysPass = null;

  				_this.sun = null;

  				_this.directionalLight = null;

  				return _this;
  		}

  		createClass(GodRaysDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);
  						var textureLoader = new three.TextureLoader(loadingManager);
  						var modelLoader = new three.ObjectLoader(loadingManager);

  						var path = "textures/skies/starry/";
  						var format = ".png";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});

  								modelLoader.load("models/waggon.json", function (object) {

  										object.rotation.x = Math.PI * 0.25;
  										object.rotation.y = Math.PI * 0.75;

  										assets.set("waggon", object);
  								});

  								textureLoader.load("textures/wood.jpg", function (texture) {

  										texture.wrapS = texture.wrapT = three.RepeatWrapping;
  										assets.set("wood-diffuse", texture);
  								});

  								textureLoader.load("textures/woodnormals.jpg", function (texture) {

  										texture.wrapS = texture.wrapT = three.RepeatWrapping;
  										assets.set("wood-normals", texture);
  								});

  								textureLoader.load("textures/sun.png", function (texture) {

  										assets.set("sun-diffuse", texture);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);
  						this.controls.target.set(0, 0.5, 0);

  						camera.position.set(-5, -1, -4);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x0f0f0f);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(-1, 1, 1);
  						directionalLight.target.position.copy(scene.position);

  						this.directionalLight = directionalLight;

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var object = assets.get("waggon");
  						var material = new three.MeshPhongMaterial({
  								color: 0xffffff,
  								map: assets.get("wood-diffuse"),
  								normalMap: assets.get("wood-normals"),
  								fog: true
  						});

  						object.traverse(function (child) {

  								child.material = material;
  						});

  						scene.add(object);

  						var sunMaterial = new three.PointsMaterial({
  								map: assets.get("sun-diffuse"),
  								size: 100,
  								sizeAttenuation: true,
  								color: 0xffddaa,
  								alphaTest: 0,
  								transparent: true,
  								fog: false
  						});

  						var sunGeometry = new three.BufferGeometry();
  						sunGeometry.addAttribute("position", new three.BufferAttribute(new Float32Array(3), 3));
  						var sun = new three.Points(sunGeometry, sunMaterial);
  						sun.frustumCulled = false;
  						sun.position.set(75, 25, 100);

  						this.sun = sun;
  						scene.add(sun);

  						composer.addPass(new RenderPass(scene, camera));

  						var pass = new GodRaysPass(scene, camera, sun, {
  								resolutionScale: 0.6,
  								kernelSize: KernelSize.SMALL,
  								intensity: 1.0,
  								density: 0.96,
  								decay: 0.93,
  								weight: 0.4,
  								exposure: 0.6,
  								samples: 60,
  								clampMax: 1.0
  						});

  						pass.renderToScreen = true;
  						this.godRaysPass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var directionalLight = this.directionalLight;
  						var composer = this.composer;
  						var pass = this.godRaysPass;
  						var sun = this.sun;

  						var params = {
  								"resolution": pass.resolutionScale,
  								"blurriness": pass.kernelSize,
  								"intensity": pass.intensity,
  								"density": pass.godRaysMaterial.uniforms.density.value,
  								"decay": pass.godRaysMaterial.uniforms.decay.value,
  								"weight": pass.godRaysMaterial.uniforms.weight.value,
  								"exposure": pass.godRaysMaterial.uniforms.exposure.value,
  								"clampMax": pass.godRaysMaterial.uniforms.clampMax.value,
  								"samples": pass.samples,
  								"color": sun.material.color.getHex(),
  								"blend mode": "screen"
  						};

  						gui.add(params, "resolution").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.resolutionScale = params.resolution;
  								composer.setSize();
  						});

  						gui.add(params, "blurriness").min(KernelSize.VERY_SMALL).max(KernelSize.HUGE).step(1).onChange(function () {

  								pass.kernelSize = params.blurriness;
  						});

  						gui.add(params, "intensity").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.intensity = params.intensity;
  						});

  						gui.add(params, "density").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.godRaysMaterial.uniforms.density.value = params.density;
  						});

  						gui.add(params, "decay").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.godRaysMaterial.uniforms.decay.value = params.decay;
  						});

  						gui.add(params, "weight").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.godRaysMaterial.uniforms.weight.value = params.weight;
  						});

  						gui.add(params, "exposure").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.godRaysMaterial.uniforms.exposure.value = params.exposure;
  						});

  						gui.add(params, "clampMax").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.godRaysMaterial.uniforms.clampMax.value = params.clampMax;
  						});

  						gui.add(params, "samples").min(15).max(200).step(1).onChange(function () {

  								pass.samples = params.samples;
  						});

  						gui.addColor(params, "color").onChange(function () {

  								sun.material.color.setHex(params.color);directionalLight.color.setHex(params.color);
  						});

  						gui.add(params, "blend mode", ["add", "screen"]).onChange(function () {

  								pass.combineMaterial.setScreenModeEnabled(params["blend mode"] !== "add");
  						});
  				}
  		}]);
  		return GodRaysDemo;
  }(Demo);

  var TWO_PI$7 = 2.0 * Math.PI;

  var RenderDemo = function (_Demo) {
  		inherits(RenderDemo, _Demo);

  		function RenderDemo(composer) {
  				classCallCheck(this, RenderDemo);

  				var _this = possibleConstructorReturn(this, (RenderDemo.__proto__ || Object.getPrototypeOf(RenderDemo)).call(this, composer));

  				_this.object = null;

  				return _this;
  		}

  		createClass(RenderDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var textureLoader = new three.TextureLoader(loadingManager);
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/sunset/";
  						var format = ".png";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});

  								textureLoader.load("textures/crate.jpg", function (texture) {

  										texture.wrapS = texture.wrapT = three.RepeatWrapping;
  										assets.set("crate-color", texture);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);

  						camera.position.set(-3, 0, -3);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(1440, 200, 2000);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var mesh = new three.Mesh(new three.BoxBufferGeometry(1, 1, 1), new three.MeshPhongMaterial({
  								color: 0xffffff,
  								map: assets.get("crate-color")
  						}));

  						this.object = mesh;
  						scene.add(mesh);

  						var pass = new RenderPass(scene, camera);
  						pass.renderToScreen = true;

  						composer.addPass(pass);
  				}
  		}, {
  				key: "update",
  				value: function update(delta) {

  						var object = this.object;

  						if (object !== null) {

  								object.rotation.x += 0.0005;
  								object.rotation.y += 0.001;

  								if (object.rotation.x >= TWO_PI$7) {

  										object.rotation.x -= TWO_PI$7;
  								}

  								if (object.rotation.y >= TWO_PI$7) {

  										object.rotation.y -= TWO_PI$7;
  								}
  						}
  				}
  		}]);
  		return RenderDemo;
  }(Demo);

  var ShockWaveDemo = function (_Demo) {
  		inherits(ShockWaveDemo, _Demo);

  		function ShockWaveDemo(composer) {
  				classCallCheck(this, ShockWaveDemo);

  				var _this = possibleConstructorReturn(this, (ShockWaveDemo.__proto__ || Object.getPrototypeOf(ShockWaveDemo)).call(this, composer));

  				_this.shockWavePass = null;

  				return _this;
  		}

  		createClass(ShockWaveDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/space3/";
  						var format = ".jpg";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);

  						camera.position.set(5, 1, 5);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(-1, 1, 1);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var geometry = new three.SphereBufferGeometry(1, 64, 64);
  						var material = new three.MeshBasicMaterial({
  								color: 0xffff00,
  								envMap: assets.get("sky")
  						});

  						var mesh = new three.Mesh(geometry, material);
  						scene.add(mesh);

  						composer.addPass(new RenderPass(scene, camera));

  						var pass = new ShockWavePass(camera, mesh.position, {
  								speed: 1.0,
  								maxRadius: 0.5,
  								waveSize: 0.2,
  								amplitude: 0.05
  						});

  						pass.renderToScreen = true;
  						this.shockWavePass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var pass = this.shockWavePass;

  						var params = {
  								"speed": pass.speed,
  								"size": pass.shockWaveMaterial.uniforms.size.value,
  								"extent": pass.shockWaveMaterial.uniforms.maxRadius.value,
  								"waveSize": pass.shockWaveMaterial.uniforms.waveSize.value,
  								"amplitude": pass.shockWaveMaterial.uniforms.amplitude.value
  						};

  						gui.add(params, "speed").min(0.0).max(10.0).step(0.001).onChange(function () {

  								pass.speed = params.speed;
  						});

  						gui.add(params, "size").min(0.01).max(2.0).step(0.001).onChange(function () {

  								pass.shockWaveMaterial.uniforms.size.value = params.size;
  						});

  						gui.add(params, "extent").min(0.0).max(10.0).step(0.001).onChange(function () {

  								pass.shockWaveMaterial.uniforms.maxRadius.value = params.extent;
  						});

  						gui.add(params, "waveSize").min(0.0).max(2.0).step(0.001).onChange(function () {

  								pass.shockWaveMaterial.uniforms.waveSize.value = params.waveSize;
  						});

  						gui.add(params, "amplitude").min(0.0).max(0.25).step(0.001).onChange(function () {

  								pass.shockWaveMaterial.uniforms.amplitude.value = params.amplitude;
  						});

  						gui.add(pass, "explode");
  				}
  		}]);
  		return ShockWaveDemo;
  }(Demo);

  var TWO_PI$8 = 2.0 * Math.PI;

  var SMAADemo = function (_Demo) {
  		inherits(SMAADemo, _Demo);

  		function SMAADemo(composer) {
  				classCallCheck(this, SMAADemo);

  				var _this = possibleConstructorReturn(this, (SMAADemo.__proto__ || Object.getPrototypeOf(SMAADemo)).call(this, composer));

  				_this.renderer = null;

  				_this.renderer2 = null;

  				_this.controls2 = null;

  				_this.renderPass = null;

  				_this.smaaPass = null;

  				_this.texturePass = null;

  				_this.objectA = null;

  				_this.objectB = null;

  				_this.objectC = null;

  				return _this;
  		}

  		createClass(SMAADemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var textureLoader = new three.TextureLoader(loadingManager);
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/sunset/";
  						var format = ".png";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						var image = void 0;

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});

  								textureLoader.load("textures/crate.jpg", function (texture) {

  										texture.wrapS = texture.wrapT = three.RepeatWrapping;
  										assets.set("crate-color", texture);
  								});

  								image = new Image();
  								image.addEventListener("load", function () {

  										assets.set("smaa-search", this);
  										loadingManager.itemEnd("smaa-search");
  								});

  								loadingManager.itemStart("smaa-search");
  								image.src = SMAAPass.searchImageDataUrl;

  								image = new Image();
  								image.addEventListener("load", function () {

  										assets.set("smaa-area", this);
  										loadingManager.itemEnd("smaa-area");
  								});

  								loadingManager.itemStart("smaa-area");
  								image.src = SMAAPass.areaImageDataUrl;
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.renderer2 = function () {

  								var renderer = new three.WebGLRenderer({
  										logarithmicDepthBuffer: true,
  										antialias: false
  								});

  								renderer.setSize(window.innerWidth, window.innerHeight);
  								renderer.setClearColor(0x000000);
  								renderer.setPixelRatio(window.devicePixelRatio);

  								return renderer;
  						}();

  						this.renderer = composer.replaceRenderer(this.renderer2);

  						this.controls = new three.OrbitControls(camera, this.renderer.domElement);
  						this.controls2 = new three.OrbitControls(camera, this.renderer2.domElement);

  						camera.position.set(-3, 0, -3);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(1440, 200, 2000);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var mesh = new three.Mesh(new three.BoxBufferGeometry(1, 1, 1), new three.MeshBasicMaterial({
  								color: 0x000000,
  								wireframe: true
  						}));

  						mesh.position.set(1.25, 0, -1.25);

  						this.objectA = mesh;
  						scene.add(mesh);

  						mesh = new three.Mesh(new three.BoxBufferGeometry(1, 1, 1), new three.MeshPhongMaterial({
  								map: assets.get("crate-color")
  						}));

  						mesh.position.set(-1.25, 0, 1.25);

  						this.objectB = mesh;
  						scene.add(mesh);

  						mesh = new three.Mesh(new three.BoxBufferGeometry(0.25, 8.25, 0.25), new three.MeshPhongMaterial({
  								color: 0x0d0d0d
  						}));

  						var object = new three.Object3D();

  						var o0 = void 0,
  						    o1 = void 0,
  						    o2 = void 0;

  						o0 = object.clone();

  						var clone = mesh.clone();
  						clone.position.set(-4, 0, 4);
  						o0.add(clone);
  						clone = mesh.clone();
  						clone.position.set(4, 0, 4);
  						o0.add(clone);
  						clone = mesh.clone();
  						clone.position.set(-4, 0, -4);
  						o0.add(clone);
  						clone = mesh.clone();
  						clone.position.set(4, 0, -4);
  						o0.add(clone);

  						o1 = o0.clone();
  						o1.rotation.set(Math.PI / 2, 0, 0);
  						o2 = o0.clone();
  						o2.rotation.set(0, 0, Math.PI / 2);

  						object.add(o0);
  						object.add(o1);
  						object.add(o2);

  						object.scale.set(0.1, 0.1, 0.1);

  						this.objectC = object;
  						scene.add(object);

  						var pass = new RenderPass(scene, camera);
  						this.renderPass = pass;
  						composer.addPass(pass);

  						pass = new SMAAPass(assets.get("smaa-search"), assets.get("smaa-area"));
  						pass.renderToScreen = true;
  						this.smaaPass = pass;
  						composer.addPass(pass);

  						pass = new TexturePass(this.smaaPass.renderTargetColorEdges.texture);
  						pass.renderToScreen = true;
  						pass.enabled = false;
  						this.texturePass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "update",
  				value: function update(delta) {

  						var objectA = this.objectA;
  						var objectB = this.objectB;
  						var objectC = this.objectC;

  						if (objectA !== null) {

  								objectA.rotation.x += 0.0005;
  								objectA.rotation.y += 0.001;

  								objectB.rotation.copy(objectA.rotation);
  								objectC.rotation.copy(objectA.rotation);

  								if (objectA.rotation.x >= TWO_PI$8) {

  										objectA.rotation.x -= TWO_PI$8;
  								}

  								if (objectA.rotation.y >= TWO_PI$8) {

  										objectA.rotation.y -= TWO_PI$8;
  								}
  						}
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var composer = this.composer;
  						var renderPass = this.renderPass;
  						var smaaPass = this.smaaPass;
  						var texturePass = this.texturePass;

  						var renderer1 = this.renderer;
  						var renderer2 = this.renderer2;

  						var controls1 = this.controls;
  						var controls2 = this.controls2;

  						var SMAAMode = {
  								disabled: "disabled",
  								edges: "edges",
  								blend: "blend"
  						};

  						var params = {
  								"browser AA": false,
  								"SMAA": SMAAMode.blend,
  								"sensitivity": Number.parseFloat(smaaPass.colorEdgesMaterial.defines.EDGE_THRESHOLD),
  								"search steps": Number.parseFloat(smaaPass.weightsMaterial.defines.MAX_SEARCH_STEPS_INT)
  						};

  						function toggleSMAAMode() {

  								renderPass.renderToScreen = params.SMAA === SMAAMode.disabled;
  								smaaPass.enabled = params.SMAA !== SMAAMode.disabled;
  								texturePass.enabled = params.SMAA === SMAAMode.edges;
  						}

  						function swapRenderers() {

  								var size = composer.renderer.getSize();

  								if (params["browser AA"]) {

  										renderer1.setSize(size.width, size.height);
  										composer.replaceRenderer(renderer1);
  										controls1.enabled = true;
  										controls2.enabled = false;
  								} else {

  										renderer2.setSize(size.width, size.height);
  										composer.replaceRenderer(renderer2);
  										controls1.enabled = false;
  										controls2.enabled = true;
  								}
  						}

  						gui.add(params, "browser AA").onChange(swapRenderers);
  						gui.add(params, "SMAA", SMAAMode).onChange(toggleSMAAMode);

  						gui.add(params, "sensitivity").min(0.05).max(0.5).step(0.01).onChange(function () {

  								smaaPass.colorEdgesMaterial.setEdgeDetectionThreshold(params.sensitivity);
  						});

  						gui.add(params, "search steps").min(8).max(112).step(1).onChange(function () {

  								smaaPass.weightsMaterial.setOrthogonalSearchSteps(params["search steps"]);
  						});
  				}
  		}, {
  				key: "reset",
  				value: function reset() {

  						get(SMAADemo.prototype.__proto__ || Object.getPrototypeOf(SMAADemo.prototype), "reset", this).call(this);

  						this.renderer.dispose();
  						this.renderer = null;

  						this.controls2.dispose();
  						this.controls2 = null;
  				}
  		}]);
  		return SMAADemo;
  }(Demo);

  var TWO_PI$9 = 2.0 * Math.PI;

  var ToneMappingDemo = function (_Demo) {
  		inherits(ToneMappingDemo, _Demo);

  		function ToneMappingDemo(composer) {
  				classCallCheck(this, ToneMappingDemo);

  				var _this = possibleConstructorReturn(this, (ToneMappingDemo.__proto__ || Object.getPrototypeOf(ToneMappingDemo)).call(this, composer));

  				_this.toneMappingPass = null;

  				_this.object = null;

  				return _this;
  		}

  		createClass(ToneMappingDemo, [{
  				key: "load",
  				value: function load(callback) {
  						var _this2 = this;

  						var assets = new Map();
  						var loadingManager = this.loadingManager;
  						var textureLoader = new three.TextureLoader(loadingManager);
  						var cubeTextureLoader = new three.CubeTextureLoader(loadingManager);

  						var path = "textures/skies/sunset/";
  						var format = ".png";
  						var urls = [path + "px" + format, path + "nx" + format, path + "py" + format, path + "ny" + format, path + "pz" + format, path + "nz" + format];

  						if (this.assets === null) {

  								loadingManager.onProgress = function (item, loaded, total) {

  										if (loaded === total) {

  												_this2.assets = assets;

  												callback();
  										}
  								};

  								cubeTextureLoader.load(urls, function (textureCube) {

  										assets.set("sky", textureCube);
  								});

  								textureLoader.load("textures/crate.jpg", function (texture) {

  										texture.wrapS = texture.wrapT = three.RepeatWrapping;
  										assets.set("crate-color", texture);
  								});
  						} else {

  								callback();
  						}
  				}
  		}, {
  				key: "initialise",
  				value: function initialise() {

  						var scene = this.scene;
  						var camera = this.camera;
  						var assets = this.assets;
  						var composer = this.composer;

  						this.controls = new three.OrbitControls(camera, composer.renderer.domElement);

  						camera.position.set(-3, 0, -3);
  						camera.lookAt(this.controls.target);

  						scene.background = assets.get("sky");

  						var ambientLight = new three.AmbientLight(0x666666);
  						var directionalLight = new three.DirectionalLight(0xffbbaa);

  						directionalLight.position.set(1440, 200, 2000);
  						directionalLight.target.position.copy(scene.position);

  						scene.add(directionalLight);
  						scene.add(ambientLight);

  						var mesh = new three.Mesh(new three.BoxBufferGeometry(1, 1, 1), new three.MeshPhongMaterial({
  								map: assets.get("crate-color")
  						}));

  						this.object = mesh;
  						scene.add(mesh);

  						composer.addPass(new RenderPass(scene, camera));

  						var pass = new ToneMappingPass({
  								adaptive: true,
  								resolution: 256,
  								distinction: 1.0
  						});

  						pass.renderToScreen = true;
  						this.toneMappingPass = pass;
  						composer.addPass(pass);
  				}
  		}, {
  				key: "update",
  				value: function update(delta) {

  						var object = this.object;

  						if (object !== null) {

  								object.rotation.x += 0.0005;
  								object.rotation.y += 0.001;

  								if (object.rotation.x >= TWO_PI$9) {

  										object.rotation.x -= TWO_PI$9;
  								}

  								if (object.rotation.y >= TWO_PI$9) {

  										object.rotation.y -= TWO_PI$9;
  								}
  						}
  				}
  		}, {
  				key: "configure",
  				value: function configure(gui) {

  						var pass = this.toneMappingPass;

  						var params = {
  								"resolution": Math.round(Math.log(pass.resolution) / Math.log(2)),
  								"adaptive": pass.adaptive,
  								"distinction": pass.luminosityMaterial.uniforms.distinction.value,
  								"adaption rate": pass.adaptiveLuminosityMaterial.uniforms.tau.value,
  								"average lum": pass.toneMappingMaterial.uniforms.averageLuminance.value,
  								"min lum": pass.adaptiveLuminosityMaterial.uniforms.minLuminance.value,
  								"max lum": pass.toneMappingMaterial.uniforms.maxLuminance.value,
  								"middle grey": pass.toneMappingMaterial.uniforms.middleGrey.value
  						};

  						gui.add(params, "resolution").min(6).max(11).step(1).onChange(function () {

  								pass.resolution = Math.pow(2, params.resolution);
  						});

  						gui.add(params, "adaptive").onChange(function () {

  								pass.adaptive = params.adaptive;
  						});

  						var f = gui.addFolder("Luminance");

  						f.add(params, "distinction").min(1.0).max(10.0).step(0.1).onChange(function () {

  								pass.luminosityMaterial.uniforms.distinction.value = params.distinction;
  						});

  						f.add(params, "adaption rate").min(0.0).max(2.0).step(0.01).onChange(function () {

  								pass.adaptiveLuminosityMaterial.uniforms.tau.value = params["adaption rate"];
  						});

  						f.add(params, "average lum").min(0.01).max(1.0).step(0.01).onChange(function () {

  								pass.toneMappingMaterial.uniforms.averageLuminance.value = params["average lum"];
  						});

  						f.add(params, "min lum").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.adaptiveLuminosityMaterial.uniforms.minLuminance.value = params["min lum"];
  						});

  						f.add(params, "max lum").min(0.0).max(32.0).step(1).onChange(function () {

  								pass.toneMappingMaterial.uniforms.maxLuminance.value = params["max lum"];
  						});

  						f.add(params, "middle grey").min(0.0).max(1.0).step(0.01).onChange(function () {

  								pass.toneMappingMaterial.uniforms.middleGrey.value = params["middle grey"];
  						});

  						f.open();
  				}
  		}]);
  		return ToneMappingDemo;
  }(Demo);

  var App = function () {
  			function App() {
  						classCallCheck(this, App);


  						this.clock = new three.Clock();

  						this.composer = function () {

  									var renderer = new three.WebGLRenderer({
  												logarithmicDepthBuffer: true,
  												antialias: true
  									});

  									renderer.setSize(window.innerWidth, window.innerHeight);
  									renderer.setClearColor(0x000000);
  									renderer.setPixelRatio(window.devicePixelRatio);

  									return new EffectComposer(renderer, {
  												stencilBuffer: true,
  												depthTexture: true
  									});
  						}();

  						this.stats = function () {

  									var stats = new Stats();
  									stats.showPanel(0);
  									stats.dom.id = "stats";

  									return stats;
  						}();

  						this.demos = function (composer) {

  									var demos = new Map();

  									demos.set("render", new RenderDemo(composer));
  									demos.set("bloom", new BloomDemo(composer));
  									demos.set("blur", new BlurDemo(composer));
  									demos.set("bokeh", new BokehDemo(composer));
  									demos.set("bokeh2", new Bokeh2Demo(composer));
  									demos.set("depth", new DepthDemo(composer));
  									demos.set("dot-screen", new DotScreenDemo(composer));
  									demos.set("film", new FilmDemo(composer));
  									demos.set("glitch", new GlitchDemo(composer));
  									demos.set("god-rays", new GodRaysDemo(composer));
  									demos.set("pixelation", new PixelationDemo(composer));
  									demos.set("shock-wave", new ShockWaveDemo(composer));
  									demos.set("smaa", new SMAADemo(composer));
  									demos.set("tone-mapping", new ToneMappingDemo(composer));

  									return demos;
  						}(this.composer);

  						this.effect = function (demos) {

  									var key = window.location.hash.slice(1);

  									if (key.length === 0 || !demos.has(key)) {

  												key = demos.keys().next().value;
  									}

  									return key;
  						}(this.demos);
  			}

  			createClass(App, [{
  						key: "initialise",
  						value: function initialise(viewport, aside, loadingMessage) {

  									var app = this;

  									var composer = this.composer;
  									var renderer = composer.renderer;
  									var clock = this.clock;
  									var stats = this.stats;
  									var demos = this.demos;

  									var demo = null;
  									var gui = null;

  									viewport.appendChild(renderer.domElement);
  									aside.appendChild(stats.dom);

  									function activateDemo() {

  												demo.initialise();

  												demo.camera.aspect = window.innerWidth / window.innerHeight;
  												demo.camera.updateProjectionMatrix();

  												gui = new dat.GUI({ autoPlace: false });
  												gui.add(app, "effect", Array.from(demos.keys())).onChange(loadDemo);
  												demo.configure(gui);
  												aside.appendChild(gui.domElement);

  												loadingMessage.style.display = "none";
  												renderer.domElement.style.visibility = "visible";
  									}

  									function loadDemo() {

  												var size = renderer.getSize();

  												loadingMessage.style.display = "block";
  												renderer.domElement.style.visibility = "hidden";

  												if (gui !== null) {

  															gui.destroy();
  															aside.removeChild(gui.domElement);
  												}

  												if (demo !== null) {

  															demo.reset();
  															renderer.setSize(size.width, size.height);
  															composer.replaceRenderer(renderer);
  												}

  												composer.reset();
  												demo = demos.get(app.effect);
  												demo.load(activateDemo);

  												window.location.hash = app.effect;
  									}

  									loadDemo();

  									document.addEventListener("keydown", function onKeyDown(event) {

  												if (event.altKey) {

  															event.preventDefault();
  															aside.style.visibility = aside.style.visibility === "hidden" ? "visible" : "hidden";
  												}
  									});

  									window.addEventListener("resize", function () {

  												var id = 0;

  												function handleResize(event) {

  															var width = event.target.innerWidth;
  															var height = event.target.innerHeight;

  															composer.setSize(width, height);
  															demo.camera.aspect = width / height;
  															demo.camera.updateProjectionMatrix();

  															id = 0;
  												}

  												return function onResize(event) {

  															if (id === 0) {

  																		id = setTimeout(handleResize, 66, event);
  															}
  												};
  									}());

  									(function render(now) {

  												var delta = clock.getDelta();

  												requestAnimationFrame(render);

  												stats.begin();

  												demo.update(delta);
  												composer.render(delta);

  												stats.end();
  									})();
  						}
  			}]);
  			return App;
  }();

  window.addEventListener("load", function main(event) {

  	var viewport = document.getElementById("viewport");
  	var loadingMessage = viewport.children[0];
  	var aside = document.getElementById("aside");

  	var app = new App();

  	window.removeEventListener("load", main);
  	aside.style.visibility = "visible";

  	app.initialise(viewport, aside, loadingMessage);
  });

}(THREE,dat,Stats));
